generator « HBM « JPA Q&A

1. Shared sequence generator for IDs and DB scheme creation using hbm2ddl

all. I have an issue with DB scheme generation via hbm2ddl. I want to use shared sequence generator for all private keys. So I defined it once in some entity.

@SequenceGenerator(name = "MY_SEQUENCE_GENERATOR", ...

2. generator in .hbm

i can't see constructor , which has one key parameter , in VO after i changed sequence from assinged in of xml. how could i make it able to generate constructor that has one key parameter without chaing it "assigned" ? seq_product_store /id>

3. How to get the id generator type from the HBM file???

I see. It should not be a problem to create a new Conifuration object that reflects your config using org.hibernate.cfg.Configuration. At least you need to have access (or know the location) to your configuration file. You should destroy the configuration object after your examination. I am not sure if a new config object causes any trouble because of singleton issues but ...