-->
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: Hibernate and DB schema
PostPosted: Thu Dec 16, 2010 5:09 pm 
Newbie

Joined: Wed Jul 07, 2010 5:27 pm
Posts: 1
Hello Dear Community,
I faced with the situation for which I cannot find an answer. I was included in a project which uses Hibernate as an ORM, but I have not seen the data schema modified this way before. The thing is some foreign keys are deleted. For instance there are two entities
Code:
<class lazy="false" name="com.addspi.tec.db.model.Region" table="REGIONS">
...
<bag cascade="all" inverse="true" lazy="false" name="cities" order-by="NAME">
   <key>
    <column name="REGION_ID"/>
    <!-- a foreign key in CITIES referencing the primary key of this table. -->
   </key>
   <one-to-many class="com.addspi.tec.db.model.City"/>
  </bag>
...
</class>



and

Code:
<class name="com.addspi.tec.db.model.City" lazy="false" table="CITIES">
...
<many-to-one
        name="region"
        class="com.addspi.tec.db.model.Region"
        lazy="false">
   <column name="REGION_ID" not-null="true" length="20" />
   </many-to-one>
...
</class>


but the is no foreign key in the database for the table Cities. There are plenty places in the application where schema was modified this way. What I would like to ask is:

If it is a common practice to may such schema modifications and is it possible to have some revenue from them? Would it possible for Hibernate work properly without foreign keys at all?

What I have right now is inconsistent data and this approach looks to me like not so convenient. Please, share your thoughts regarding it. Thanks.

Pavel


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.