hbm2java should generate POJO entities with stable property order to ease development
cycle
-------------------------------------------------------------------------------------------
Key: HBX-1146
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1146
Project: Hibernate Tools
Issue Type: New Feature
Components: hbm2java
Affects Versions: 3.2.2
Environment: Hibernate Tools 3.2.2, Seam 2.1.2, DB2
Reporter: Julien Kronegg
Priority: Minor
Attachments: patch_EntityPOJOClass.txt
When generating entities using Hibernate hbm2java Ant task, the POJO annotated entity
properties are not generated in the same order at each run. This is because the POJO
properties are stored in data structures that do not have a given order (e.g. a
java.util.Set).
Not having the same property order at each run is painful for the programmer: the property
order of the new entity file is not the same of the previous version, which requires
merging the two files. The merge operation duration could be reduced if the properties
were generated in the same order at each run.
This is very important for projects that use an incremental development cycle where the
database tables structure are often modified (e.g. adding a column, changing a column
type).
The patch "patch_EntityPOJOClass.txt" gives a solution based on the
org.hibernate.tool.hbm2x.pojo.EntityPOJOClass class. The Entity properties are sorted by
the following types:
1. identifier
2. simple properties
3. many-to-one properties
4. Collections
Within a given property type, properties are sorted alphabetically by their property
name.
This patch also solves the same issue in other generated files, such as Seam's
EntityHome and EntityList.
--
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