[hibernate-dev] How to configure schema name for mapped entity / table in JPA / hibernate
Sanne Grinovero
sanne at hibernate.org
Tue Sep 4 03:17:05 EDT 2012
Hi,
I once had a similar requirement, which was easily resolved by
implementing a custom NamingStrategy
http://docs.jboss.org/hibernate/core/4.1/manual/en-US/html_single/#configuration-namingstrategy
You could either have two different strategies, or have one which
reads some configuration file.
Alternatively you could use XML mapping.
Sanne
On 4 September 2012 04:29, Tang Jianyu <jianyunet at gmail.com> wrote:
> Hi,
>
> I have a question posted to stackoverflow but haven't get answer, so
> want to check if someone here can help me
>
> http://stackoverflow.com/questions/12192453/how-to-configure-schema-name-for-mapped-entity-table-in-jpa-hibernate
>
> I have an application which need to access 2 schemas at runtime, and
> the schema names need to be configured when deploy, because the name
> are different for each deployment (for assembly testing, integration
> testing, performance testing...)
>
> I know JPA / hibernate can specify schema on @Table annotation, but I
> need to make the schema configurable, is there anyway to add a post
> processor / event listener so I can modify the hibernate meta info,
> and change the table schema with my configuration?
>
> Currently I'm looking into rewrite my own HibernateJpaVendorAdapter /
> HibernatePersistence / MetaProvider, but definitely this is not a good
> idea.
>
> Thanks
>
> Jeffrey
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
More information about the hibernate-dev
mailing list