openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim O'Rourke <>
Subject Problems with MappingToolTask
Date Mon, 16 May 2011 18:16:06 GMT
I'm trying to generate an SQL script that can be run against an empty (schema
but not no tables/sequences/indexes etc) database using ant, OpenJPA 2.1.0,
and Postgresql 8.3.1 on Windows XP sp3.  I have NO <properties> elements in
my persistence.xml, and my ant task follows:

	<target name="gen-ddl" >
		<taskdef name="mappingtool" classpathref="app.classpath" 
			classname="org.apache.openjpa.jdbc.ant.MappingToolTask" />
		<mappingtool action="refresh" 
			<config propertiesFile="${resources.src}/META-INF/persistence.xml" 
					DBDictionary="postgres" Log="Tool=TRACE"
					connectionUserName="xxxxxx" connectionPassword="xxxxxx"
				    connectionDriverName="org.postgresql.Driver" />


When I run the task using a connectionURL to an empty db,  I get correct
'CREATE SEQUENCE' statements, but no foreign key constraints or associated
indexes.  When I run the task using a connectionURL to a populated db, I get
my foreign keys and fk index statements, but the create Sequence is missing
the CACHE clause.  My JPA entity ids are defined with, for example,
@SequenceGenerator(name="priceIDGen", sequenceName = "price_id_seq",
allocationSize=50).  Either connectionURL generates the appropriate
'allocate'  attribute in the schemaFile xml,and I've tried various
combinations of action and schemaAction to no avail

Also a couple "can i" questions that maybe someone can answer...
Is there a way for Java primitives to infer creation of a NOT NULL column?
It'd be nice not to have to add 'nullable=false' to all my primitive

Is there anyway to control formatting of the sql output? For example: if I'd
like line breaks on fields, or fields output in declared not alphabetical

Any Assistance appreciated.

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message