[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1117?page=c...
]
Magnus Jungsbluth commented on HBX-1117:
----------------------------------------
I can perfectly understand that you feel uncomfortable to give this much power to the
revengstrategy. But being a model-to-model transformation I think it is not unreasonable
to give target model access to the class controlling the transformation process.
This patch makes it possible to generate features in the hbm.xml files that were not
explicitly envisioned by the authors of the hibernate tools:
overrride one of the two general purpose methods, extend the templates and off you go - no
change in hibernate tools source required (=> less work for you).
Use cases we have in-house:
---------------------------------------
1) Marking columns as natural-id (impossible at the moment):
Override finishColumnMapping(..) and call mappedProperty.setNaturalIdentifier(true) on
columns you want included
2) Adding subclasses (impossible at the moment)
Override finishTableMapping(...) and call for example
- rootClass.setDiscriminator(discriminatorColumn);
- rootClass.addSubclass(subClass);
3) Multi-column properties for special user types (impossible at the moment)
Override finishTableMapping(...) and add columns to a property.
ReverseEngineeringStrategy should get access to generated
PersistentClass before executing the hbm2hbmxml export
-----------------------------------------------------------------------------------------------------------------
Key: HBX-1117
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1117
Project: Hibernate Tools
Issue Type: Patch
Components: reverse-engineer
Affects Versions: 3.2.4.GA
Environment: hibernate tools revision 16240
Reporter: Magnus Jungsbluth
Attachments: revengstrategy_persistentclass_access.patch
When implementing a ReverseEngineeringStrategy it is currently impossible to have a last
word on the generated PersistentClass. It is for instance not possible to mark natural-ids
or set discriminator fields not to speak of subclasses.
The included patch is a trivial extension of ReverseEngineering Strategy and provides two
methods that are called from JDBCBinder while doing a reverse engineering:
- finishColumnMapping(org.hibernate.mapping.Property)
- finishTableMapping(org.hibernate.mapping.PersistentClass)
With these methods a ReverseEngineeringStrategy gains full control over the generated
mapping to fine-tune results.
--
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