[hibernate-dev] How to configure schema name for mapped entity / table in JPA / hibernate

Tang Jianyu jianyunet at gmail.com
Tue Sep 4 11:38:47 EDT 2012


Thank you, this looks better than customize the meta provider and 
annotation reader.

On 9/4/12 15:17 PM, Sanne Grinovero wrote:
> 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