openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Hewett" <mark.hew...@gmail.com>
Subject Forward Mapping Column Order
Date Thu, 02 Aug 2007 22:43:00 GMT
Is there a way to control the order of the columns in the tables
generated using forward mapping?  It seems that the columns come out
in the following order:

id column
other columns sorted alphabetically
foreign key columns

Is there a way to get the "other columns" in the order they are
declared in the Java class, or to specify the order in some other way?

I tried using XML metadata instead of annotations, but the following
also results in a table with columns ordered: id, a, b, c, d.

<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
	version="1.0">
	<entity class="com.example.TestEntity">
		<attributes>
			<id name="id"></id>
			<basic name="c"></basic>
			<basic name="a"></basic>
			<basic name="d"></basic>
			<basic name="b"></basic>
		</attributes>
	</entity>
</entity-mappings>

Alphabetic ordering of fields make the data in the database hard to
browse since logically grouped columns are not together.

Thanks,
Mark

Mime
View raw message