Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Ajay Luthria

+ Follow
since Jul 15, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ajay Luthria

a).I have a Trade object which can have multiple status's. One to Many relationship

b.Now,I have inserted a new record with a status of 'New' in the parent(Trade) and child (TradeDetails) tables.
This works fine.(Code is attached below).

c.My Query is:

Now 3 days later, I want to enter a new record in the child table with the same 'parent id'
and status set to 'Verified'.

How can I insert a new record only in the child table with the status set to 'Verified'
and then another with the status set to 'Executed' for the same parent?

i.e 1 Parent - 3 Children entered on different times.

I hope I am clear in my query.

My code to create a new record in Parent and child is below.

Cameron Wallace McKenzie wrote:Remove Trade.hbm.xml from the hibernate.cfg.xml file and see if you get the same error with TradeDetails. I'm wondering if it's just a classpath issue.

-Cameron McKenzie

Hi Cameron,

Tried what you suggested and getting this error now:

It works fine when I comment out TradeDetails.hbm.xml from the Hibernate.cfg.xml and comment out one to many relation from the Trade.hbm.xml
If I run the test harness just on the Trade,the trade is saved in the trade table.....

I am trying to set one to many relation between a trade and trade details.
One trade object can have multiple trade details and status's.

I am getting the error:

Error reading resource: Trade.hbm.xml

Please suggest if I have overlooked anything?

Thanks a lot and much appreciated for all the help.

I am trying to do a many-to-many association using hibernate. I am having an
EVENT table and PERSON table. I am trying to get many-to-many association between these two tables using a junction table PERSON_EVENT. Following is the

Error: An association from the table PERSON_EVENT refers to an unmapped class: Event

This is my first attempt at using many-to-many association and after reading paul sturrock's mail regarding case sensitivity,I still get this error.

Please guide where have I gone wrong?


Paul Sturrock wrote:You included a mapped resource called "Event". Your mapping from Person is to a mapped resource called EVENT.

Remember, Java is case-sensitive.

Hi Paul,
I am having the same problem and after reading your reply tried to solve it but comes up with the error:
n association from the table PERSON_EVENT refers to an unmapped class: Event

<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/test</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">bhuru</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="">update</property>

<!-- Mapping files -->
<mapping resource="Event.hbm.xml"/>
<mapping resource="Person.hbm.xml"/>


<class name="Person" table="PERSON">

<id name="id" column="PERSON_ID">
<generator class="native"/>

<property name="firstName"/>

<set name="events" table="PERSON_EVENT">
<key column="PERSON_ID"/>
<many-to-many column="EVENT_ID" class="Event"/>




<class name="hibernate.Event" table="EVENT">

<id name="id" column="EVENT_ID">
<generator class="native"/>

<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>



I would genuinely appreciate any help.