Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with using property in formula [hibernate]

 
Sergey Shantor
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have many-to-many relationship:

COMPANY * - * EMPLOYEE

here is CompanyDTO (POJO):



and also сompanyDTO.hbm.xml :



the question is next- how can I use the employee_id from the related table, to get the proper meaning from table "position", that consist of (company_id[Long], employee_id[Long]) - individual for each [employee 1 - 1 company]

private EmployeeDTO employee is already set for necessary Employee meaning
structure.JPG
[Thumbnail for structure.JPG]
 
Sergey Shantor
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
solved with

<join table="COMP_EMPL" inverse="true" optional="true">
<key column="company_id" />
<many-to-one name="employee" column="employee_id"
not-null="true" />

<property name="position" type="string">

<formula>position</formula>
</property>


</join>
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, what a thorough post! Very impressive for a Greenhorn. And thanks for posting back an answer. That's the spirit of giving.

I sent you a private message, so feel free to check your private messages on JavaRanch.

Kindest regards,

-Cameron
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic