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