Rafael,

 You could use annotations to describe the mappings but if not use the
following. Since you are using Spring you can use their Hibernate
support to look for mapping files in a particular directory. This way
you don't have to call them out in the hibernate file. Lookup
org.springframework.orm.hibernate3.LocalSessionFactoryBean. Here is an
example:

        <bean id="sessionFactory"
                
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                <property name="dataSource">
                        <ref local="dataSource" />
                </property>
                <property name="hibernateProperties">
                        <props>
                                <prop key="hibernate.cache.provider_class">
                                        
org.hibernate.cache.HashtableCacheProvider
                                </prop>
                                <prop key="hibernate.dialect">
                                        org.hibernate.dialect.Oracle10gDialect
                                </prop>
                                <prop key="hibernate.show_sql">false</prop>
                                <prop key="hibernate.format_sql">false</prop>
                        </props>
                </property>
                <property name="mappingDirectoryLocations">
                        <list>
                                <value>
                                        
classpath*:/org/myexample/server/dao/hibernate
                                </value>
                        </list>
                </property>
        </bean>

The mappingDirectoryLocations property tells spring to look for
hbm.xml files in the org.myexample.server.dao.hibernate package. Then
you need a *.hbm.xml for each table and the relationships are defined
in those files. You also need a datasource described in your
application context.

Hope this helps.

Gordon Pike
http://devbright.com

On May 20, 10:52 am, Rafael <boraf...@gmail.com> wrote:
> Hello everyone!
>
>    I have the following problem and was hoping you guys could help me
> out. I have the need to implement a relation inheritance (table per
> subclass) so i searched the hibernate documentation.
>    The thing is that i am using a project structure which i took from
> a tutorial i found, and i have the following configuration files:
>
> applicationContext.xml (Spring stuff i suppose)
>
> hibernate.cfg.xml (mappings)
> database.hbm.xml (hibernate query definitions)
>
> My question is where should the code to define complex relations
> should go, hibernate.cfg.xml or database.hbm.xml?
>
> Is it possible to take care of everything with annotations
> (eliminating the need to change xml files)?
>
> Thanks in advance y'all!
>
> PD: Thank you Eggsy for your tutorial on GWT, Hibernate ans Spring
> combined! very enlightning :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to