Using JPA, order of database columns are reverse of how they appear in XML metadata!
------------------------------------------------------------------------------------
Key: JPA-5
URL:
http://opensource.atlassian.com/projects/hibernate/browse/JPA-5
Project: Java Persistence API
Issue Type: Bug
Environment: Testing with Windows 7 but this bug should appear everywhere.
Reporter: Colbert Philippe
Priority: Minor
It's important to have control over the order columns of each generated table. In the
past, I used Hibernate native, now I upgrated to JPA to maintain compatibility with Cloud
systems. With Hibernate native, the order of the column was the same as they appear in
the XML metadata.
However with JPA, it's a different story. The order of the generated columns is the
reverse of how they appear in the JPA XML metadata. That's not right if you are
trying interface with legacy systems and the database system is made up on legacy
databases.
My bug report has two aspects to it.
1) First spact is that the JPA XML schema
(
http://java.sun.com/xml/ns/persistence/orm_2_0.xsd) is not flexible and has strict rules
as to how to order elements inside a Java class. For instance: The attributes always come
first followed by associations. In other word they used SEQUENCE in the schema instead of
using ALTERNATIVES.
This apparent error is part of the standard and not the fault of the Hibernate.
2) Second aspect is that even within attributes in the XML metadata, the order is not
respected. In fact it is reversed to what is specified in the XML metadata file, which is
very strange. That's a definitely an error from Hibernate and should be fixed.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira