-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: <subselect> mapping with dynamic table name?
PostPosted: Mon May 21, 2007 4:50 pm 
Newbie

Joined: Mon May 21, 2007 4:41 pm
Posts: 2
Hibernate version: 3.1

Mapping documents:
<hibernate-mapping>
<class name="session.impl.SessionImpl" lazy="true"
proxy="session.Session" >
<subselect>
select distinct SESSION_ID from SESSION_CR
</subselect>
<synchronize
table="session.impl.SessionEntryImpl" />
<id name="sessionID" type="string" column="SESSION_ID" />

<set name="sessionEntries" cascade="none" inverse="true"
fetch="join" table="SESSION_CR">
<key>
<column name="SESSION_ID" />
</key>
<one-to-many
class="session.impl.SessionEntryImpl" />
</set>
</class>
</hibernate-mapping>

If you look in the mapping above, in the <subselect>, I am trying to find a way to dynamically append a schema name onto the database table name. So, for instance, in some cases I need to configure my application to do the subselect on DB1.SESSION_CR and in some cases, I need it to run on DB2.SESSION_CR.

I tried using ${hibernate.default_schema} and configuring that, but Hibernate treats the subselect as a literal string.

I've searched around for quite a bit on here and on google but haven't had much luck. Is there any way to have dynamic properties in mapping files so I can do this? If not, can I change it programatically somewhere?

Thanks in advance,
Matt


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.