• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mapping relationships and reverse mapping them  RSS feed

 
Marc Cracco
Ranch Hand
Posts: 80
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I'm probably doing this all wrong but here goes...

I have two objects Party and Event.

Party
------
partyId
partyType
...

Event
-----
eventId
eventType
eventDateTime

and then the association table

PartyEvent
-----
partyId
eventId
fromDate
thruDate

In my party.hbm.xml I have



Now here is a query I try to run:



The code builds and start properly but when I try to run the above query I get:

illegal attempt to dereference collection [party0_.PARTY_ID.events] with element property reference [eventType]

Also am I looking at this correctly: My events are unique so my party to event is a 1 : many but my event to part is 1:1. Using a table to map a relationship to the two how would I setup the hbm file on the event to get it's party since it's not a set and a one to one entry doesn't show an association table to use?
 
Marc Cracco
Ranch Hand
Posts: 80
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hope no one minds but trying a bump before I post elsewhere.
 
Bin Smith
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your event and perty tables are joined by join table PartyEvent, you should specify this in inner join statement.

Try this query:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!