I was working on small POC, wanted to use 2 generator values in hbm.xml files using Hibernate 5.2.1+ Spring 4.3.1.
*<hibernate-mapping> * * <class name="hibernate.test.Employee" table="emptest2"> * * <id name="uid"> * * <generator class="uuid"/> * * </id> * * <property name="name" /> * * </class> * * </hibernate-mapping>*
I want to make it generic for different databases, for that I have to maintain 2 different hbm.xml files for different dbs. May be I need to pass Custom generator value like uuid2, guid for connectivity with 2 databases but seems not possible or don't have any idea on this or Needed to pass a classname which can check the dialect or something.
When I see the code for DefaultIdentifierGeneratorFactory, here it registers generator (_register( "uuid2", UUIDGenerator.class );_) and maps to their relevant class file. I can't see any customized value or anything.
Also, I see one comment here with this:
*register( "guid", GUIDGenerator.class ); // can be done with UUIDGenerator + strategy*
which I was unable to understand that how can I make a GUIDGenerator from UUIDGenerator+strategy. Please let me know the solution. |
|