• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with using idbags in Hibernate, which gives persistenceException etc. Help please. Thanks!

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello. I'm using Hibernate 3.5.1 and I have been stuck in a problem for a couple days. Help Please. Thanks in advance.

I have a entity called Request, and the Request can target multiple Facility, and multiple ServiceGroup. And the Facility and ServiceGroup could be targeted by multiple Requests. This is essentially a manyToMany relationship. Due to the multiple bags problem with unordered collection, I added a index to the joint table of Request_Facility and Request_ServiceGroup.
Now the database tables look like the following:

Table Request:

(
ID int(generated by IDENTITY),
TITLE,
etc.
)

Table Facility:
(
ID int(generated by IDENTITY),
NAME.
)

Table ServiceGroup:
(
ID int(generated by IDENTITY),
NAME.
)

Table Request_Facility:
(
ID int (generated by IDENTITY),
REQUEST int (FK referencing Request),
FACILITY int (FK referencing Facility)
)

Table Request_ServiceGroup:
(
ID int (generated by IDENTITY),
REQUEST int (FK referencing Request),
SERVICEGROUP int (FK referencing ServiceGroup)
)


Thus, in the Request.java class , i have the following implementation to specify the manyToMany relationships to Facility and ServiceGroups.



but when I tried to persist a new Request targeting some facilities and serviceGroups, the following exception were thrown:



Could anybody please give me some hint? Thanks a lot in advance for your time and patience. This totally drove me nuts after spending the whole day on it,
 
alice zhu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
by the way, I have a parent class called Wokflow which has a corresponding WORKFLOW data table with ID generated by IDENTITY. The Request class extends the Workflow Class. Since both the parent class and child class have their own data tables, I used the ID of workflow and request as the join column to map them together.

The following is the implementation of the Workflow class:
 
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

If you resolved this, can you please tell what was wrong?

Thanks!
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic