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.

  1. if persistence.xml not aware of entity (either explicitly listing or auto-scanning), no jpa implementation able generate database schema t.

  2. 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

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -