openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim O'Rourke <jimorourk...@gmail.com>
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" 
				schemaaction="build"
		  		sqlfile="${resources.src}/create.sql">
			<config propertiesFile="${resources.src}/META-INF/persistence.xml" 
					DBDictionary="postgres" Log="Tool=TRACE"
					connectionUserName="xxxxxx" connectionPassword="xxxxxx"
				    connectionURL="jdbc:postgresql://localhost:5432/emptydb"
				    connectionDriverName="org.postgresql.Driver" />
		  </mappingtool>
	</target>


 

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
properties.

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
order?

Any Assistance appreciated.



--
View this message in context: http://openjpa.208410.n2.nabble.com/Problems-with-MappingToolTask-tp6369711p6369711.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message