• Post Reply Bookmark Topic Watch Topic
  • New Topic

SpringMVC and Hibernate Mapping Many-to-Many

 
Rendi Artha
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a 'interesting' problem, hopefully someone in javaranch could be switch my light ON.

Here the problem :
- I have two entities with a many-to-many association, the join table isn’t being populated when an association is made.
How can the join table is not updated after saving the entities with many-to-many associations between them?


some solution on net as describe in SOLUTION , shorted that we need to call session.flush() before commit the session between them.

My question, is it posible since I already define OSIV Listener and set session.setFlushMode(flushMode.AUTO).Is there any way to do manually flushing session on DAO? since I use HibernateDaoSupport.

Need advice from all of you.
Thank you.
 
Rendi Artha
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still need advice please. ...anythings, is there any difficulties to dechiper my message, please provide me some question .

Rgds,
Rendi Arta
 
Rendi Artha
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
noone reply...ok maybe leader please "Nathan Pruett" or "Mark Spritzler" .
 
Rendi Artha
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rendy arta wrote:noone reply...ok maybe leader please "Nathan Pruett" or "Mark Spritzler" .


Here my scenario :
- 2 entity : Transaksi dan TransDetail
- 3 table : TRANSAKSI,TRANSDETAIL & TRANSAKSI_TRANSDETAIL
- Framework : Spring + Hibernate + OSIV Filter

Here is the mapping hbm.xml

Transaksi.hbm.xml


TransDetail.hbm.xml


DAO :


OSIV Filter
-setting : session.setFlushMode(flushMode.AUTO);

Transaction mapping


Executable program at least like this :


any suggestion ? maybe " David Newton "... or else javaranch members
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So - any exceptions in the logs?



How are you getting all the ID's to set on these objects? Hibernate should be generating them for you when the object is saved...

 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!