-->
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.  [ 5 posts ] 
Author Message
 Post subject: Hibernate annotation and hibernate mapping xml file
PostPosted: Mon Jul 23, 2007 11:26 am 
Newbie

Joined: Fri Jul 13, 2007 4:41 pm
Posts: 6
Currently I am experiencing the problems with the UserCollectionType annotation. I did a research showing that the fix patch for user collection not yet ready. so I am trying to use the xml mapping file for the user collection type, and for others I still use the annotation mapping.

Can somebody let me know if this is possible? or does somebody know how to do the annotation for the use collection type? thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 24, 2007 1:05 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

You can use annotation and xml both in same application


Amila
(Dont' forget to rate if helps)


Top
 Profile  
 
 Post subject: Followup
PostPosted: Thu Jul 26, 2007 2:20 pm 
Newbie

Joined: Fri Jul 13, 2007 4:41 pm
Posts: 6
amila733 wrote:
Hi

You can use annotation and xml both in same application


Amila
(Dont' forget to rate if helps)


thanks for the responce,

do i need to specify the different session factory?

here is my current config in the beanFactory.xml

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="annotatedClasses">


my question is : do i need to add the following in the beanfactory.xml

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>


in addition, can you send me an example on this, such as xml config and the beanfactory xml for both xml mapping and annotation, thanks so lot


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 27, 2007 2:55 am 
Regular
Regular

Joined: Mon Mar 06, 2006 6:18 am
Posts: 95
Location: Bern, Switzerland
no you don't have to define a second session factory. Here is my example:

Code:
<bean id="defaultSessionFactory"
      class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
      singleton="true">
      <property name="dataSource">
         <ref bean="defaultDataSource" />
      </property>
      <property name="mappingResources">
         <list>
            <value>Address.hbm.xml</value>
            <value>Herkunft.hbm.xml</value>
            <value>Information.hbm.xml</value>
            <value>Konto.hbm.xml</value>
         </list>
      </property>
      <property name="annotatedClasses">
         <list>
            <value>najsre7.model.Aktion</value>
            <value>najsre7.model.Profil</value>
            <value>najsre7.model.Benutzer</value>
         </list>
      </property>
      <property name="hibernateProperties">
         <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
            <prop key="hibernate.show_sql">false</prop>
            <prop key="hibernate.max_fetch_depth">10</prop>
            <prop key="hibernate.cache.use_query_cache">true</prop>
            <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
         </props>
      </property>
   </bean>


Hope it helps!

regards Angela


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Fri Jul 27, 2007 2:13 pm 
Newbie

Joined: Fri Jul 13, 2007 4:41 pm
Posts: 6
Angela, thanks so lot, this really help.

Do you have an example implementing the user collection type? also the example of the hibernate mapping file. thanks so lot


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.