-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with component in multi-tables
PostPosted: Mon Jul 25, 2011 4:30 pm 
Newbie

Joined: Fri Jul 22, 2011 11:27 am
Posts: 2
People, please help me.

I have the following Oracle DataBase Model
Image

and I need map it to this Java Class Model
Image

I tried to map as follow:
Code:
<class name="Company" table="E_COMPANY">
   <id name="id" column="COMPANY_ID" type="long" />
   
   <property name="legalName" type="string" column="LEGALNAME"/>
   <property name="peopleSet" type="long" column="people_set"/>
   
   <component name="dataGeneral" class="GeneralData">
      <property name="setInterlocutors" type="long" column="interlocutors"/>
      <property name="setContacts" type="long" column="contacts"/>
      <property name="type" type="long" column="type"/>
      <property name="active" type="true_false" column="active"/>
      <!-- From joined table -->
      <property name="category" type="long" column="COMPANYCATEGORY"/>
      <property name="vip" type="true_false" column="B_VIP"/>
   </component>
   <join table="E_COMPANY_CL">
      <key column="COMPANY_ID"/>
   </join>
</class>


But Hibernate doesn't recognize the columns coming from the joined table
Quote:
Hibernate: SELECT company0_.COMPANY_ID AS COMPANY1_13_0_, company0_.LEGALNAME AS LEGALNA2_13_0_, company0_.PEOPLE_SET AS PEOPLE3_13_0_, company0_.INTERLOCUTORS AS INTERLO4_13_0_, company0_.CONTACTS AS CONTACS5_13_0_, company0_.TYPE AS TYPE6_13_0_, company0_.ACTIVE AS ACTIVE7_13_0_, company0_.COMPANYCATEGORY AS COMPANY8_13_0_, company0_.B_VIP AS B9_13_0_ FROM E_COMPANY company0_ INNER JOIN E_COMPANY_CL company0_1_ ON company0_.COMPANY_ID =company0_1_.COMPANY_ID WHERE company0_.COMPANY_ID=?
14:29:33,593 TRACE BasicBinder:82 - binding parameter [1] as [BIGINT] - 1007
14:29:33,875 WARN JDBCExceptionReporter:233 - SQL Error: 904, SQLState: 42000
14:29:33,875 ERROR JDBCExceptionReporter:234 - ORA-00904: "COMPANYCOR0_"."COMPANYCATEGORY": invalid identifier

14:29:33,875 INFO DefaultLoadEventListener:160 - Error performing load command
org.hibernate.exception.SQLGrammarException: could not load an entity: [Company#1007]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)



The component can't be mapped in a different context, because it throws a org.hibernate.MappingException: Duplicate property mapping...

I need to map these models just like they are, because I'm in a migration project, and I should not do any changes to existing models.

Any suggestion is welcome.

PD
SORRY FOR MY BAD ENGLISH, I USE A TRANSLATOR TO TRIED EXPLAIN ME IN THIS FORUM.


Top
 Profile  
 
 Post subject: Re: Problem with component in multi-tables
PostPosted: Thu Aug 11, 2011 3:36 pm 
Newbie

Joined: Fri Jul 22, 2011 11:27 am
Posts: 2
Ya que nadie respondió, el avance del proyecto se vio detenido por este percance. Se opto por modificar el modelo de base de datos para poder ser utilizado mas fácilmente por Hibernate.


[CLOSED]


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