After thinking through the problem, I came up with a solution. Thanks for the very terse reply! :)
The solution, in case anyone else has this issue. It's a bit hacky, but will do it.
Generally the configuration is through hibernate.cfg.xml, as everyone knows, so you'd have a line such as:
<mapping resource="com/myapp/Suite.hbm.xml" />
In the hibernateSessionFactory, generally you do something like:
cfg.configure(CONFIG_FILE_LOCATION); where CONFIG_FILE_LOCATION specifies where the hibernate.hbm.xml file is. Well, programmatically, you could take a command line option specifying which config to use of course. So, you could have 2 of the hibernate.cfg.xml's, one has a mapping resource like:
<mapping resource="com/myapp/Suite_assigned_id.hbm.xml" />
and the other has
<mapping resource="com/myapp/Suite_generated_id.hbm.xml" />
with the same file contents in both, except that one would have a generated sequence ID and the other an assigned ID. Problem solved.
Figured I'd post for anyone else coming up against this issue.
|