Hello,
I'm using JPA + Hibernate entity manager.
Is it possible to configure/customize/override the table name of an entity after the EntityManagerFactory is created? and how?
If not, how can I do that, for a JPA annotated class, before I build the EntityManagerFactory?
This is the code i'm using to build an EntityManagerFactory:
Code:
Ejb3Configuration config = new Ejb3Configuration();
config.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
config.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
config.setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:authdb");
config.setProperty("hibernate.connection.username", "sa");
config.setProperty("hibernate.connection.password", "");
config.setProperty("hibernate.hbm2ddl.auto", "create-drop");
//config.setProperty("hibernate.show_sql", "true");
config.addAnnotatedClass(MyClass1.class);
config.addAnnotatedClass(MyClass2.class);
entityManagerFactory = config.buildEntityManagerFactory();
In the above example, MyClass2 is annotated with @Table(name = "xyz")
How can I override that name in the configuration?
Thanks,
I