openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@gmail.com>
Subject Re: Forward Mapping Column Order
Date Fri, 03 Aug 2007 18:00:52 GMT
Hi,

I've got a change somewhere around that addresses this problem to a
certain extent. From a Java standpoint, the difficulty is that some
compilers lose the information about the field ordering.

Internally, we probably just need to make sure that we use
ClassMetaData.getFieldsInListingOrder() when generating the schema.

-Patrick

On 8/2/07, Mark Hewett <mark.hewett@gmail.com> wrote:
> 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
>


-- 
Patrick Linskey
202 669 5907

Mime
View raw message