hibernate - Create table programatically from entity annotation under JPA -
suppose jpa provider hibernate. suppose not container managed, application managed.
given entity class , correct annotation, possible create table programatically, @ runtime, , class? saying runtime, means entity class not listed in persistence.xml.
theoretically, possible because can manually read annotations , generate sql, , persistence unit can read database connection url. question is, there anyway without duplicating lots of work inside hibernate?
i found in other questions persistence.createschema used, don't see specify class.
if persistence.xml not aware of entity (either explicitly listing or auto-scanning), no jpa implementation able generate database schema t.
you can either generate whole database schema jpa annotation or don't generate entity. can't generate table definition 1 entity.
your use case smells hack , should address requirement first.
Comments
Post a Comment