-->
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.  [ 4 posts ] 
Author Message
 Post subject: Using "synonyms" oracle objects in mapping
PostPosted: Thu Nov 29, 2007 5:47 am 
Newbie

Joined: Thu Nov 29, 2007 5:42 am
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3

Hello everybody !!
I'd like to know if it's possible to use oracle synonyms or snapshots objects in hibernate mappings.
as a reminder, Oracle synonyms are virtual tables that can exists in another database.

Thanks for your help !!


Top
 Profile  
 
 Post subject: Re: Using "synonyms" oracle objects in mapping
PostPosted: Mon Dec 03, 2007 5:49 am 
Newbie

Joined: Wed Nov 24, 2004 2:44 am
Posts: 11
Luuzz wrote:
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3

Hello everybody !!
I'd like to know if it's possible to use oracle synonyms or snapshots objects in hibernate mappings.
as a reminder, Oracle synonyms are virtual tables that can exists in another database.

Thanks for your help !!


I use Oracle synonyms in my Hibernate mappings without any problem (Oracle 9i). I don't know for snapshots objects.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 03, 2007 6:04 am 
Regular
Regular

Joined: Wed Jun 20, 2007 1:53 am
Posts: 75
Hi bgillis,
Can youu explain the steps to use Oracle synonyms if possible post the mapping document as well.

Advance thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 03, 2007 6:12 am 
Newbie

Joined: Wed Nov 24, 2004 2:44 am
Posts: 11
well... it's very easy ! Just use the synonym in place of the table name in your mapping files.

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.mainsys.account.statement.model">

   <class name="Notice" table="STT_NOTICE" abstract="true">
      <id name="id" type="long">
         <column name="NOTICE_ID" precision="12" scale="0" not-null="true" />
         <generator class="sequence">
            <param name="sequence">SEQ_NOTICE</param>
           </generator>
      </id>

      <version column="NOTICE_VERSION" name="version" type="long" />

      <property name="number" type="long">
          <column name="NOTICE_NUMBER" length="12" not-null="true" />
      </property>
      <property name="type" type="NoticeTypeType" column="NOTICE_TYPE" not-null="true"/>
      <property name="date" type="StringDateType">
         <column name="NOTICE_DATE" not-null="true" />
      </property>

      <bag name="lines" table="STT_NOTICE_LINE" order-by="NOTICE_LINE_POSITION" lazy="false">
         <key column="NOTICE_ID"/>
         <element type="string" column="NOTICE_LINE_TEXT" length="78" not-null="true"/>
      </bag>

      <many-to-one name="statement" class="Statement"
         fetch="select">
         <column name="STATEMENT_ID" precision="12" scale="0" not-null="true" />
      </many-to-one>

   </class>
</hibernate-mapping>


Here the attributes "table" of <class> ("STT_NOTICE") and <bag> ("STT_NOTICE_LINE") are respectively oracle synonyms for two tables ("MSD70" & "MSD71") of my database.


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

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.