• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
alice zhu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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
  • 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:
 
Volodymyr Lysenko
Ranch Hand
Posts: 512
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

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

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic