-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Not able to persist records in DB using @JoinTable
PostPosted: Fri Oct 28, 2005 4:25 am 
Beginner
Beginner

Joined: Tue Aug 09, 2005 1:34 am
Posts: 26
Location: Bangalore
Hibernate version:3.0 beta 6

Mapping documents:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hi Everybody,

I have tried using the @JoinTable but even this does not work.

Code:
@OneToMany(cascade={CascadeType.PERSIST}, fetch=FetchType.EAGER)
   @JoinTable(
         table=@Table(name="ShowAssets"),
         joinColumns = { @JoinColumn( name="showid") },
         inverseJoinColumns = @JoinColumn( name="id")
   )
   @IndexColumn(name ="showassetid")
   public Set <AudioFile> getAudioAssets() {
      return audioAssets;
   }


public void setAudioAssets(Set <AudioFile> audioAssets) {
   this.audioAssets = audioAssets;
}


Well can anybody suggest how the OneToMany mechanism works at the Database level.

Is is that the record is automatically inserted into the JoinTable as soon as the records in the Mapped Tables


Is is that we have to explicitly insert the record


One more thing is that.
I am using Single Table Per Class Hierarchy and I am mapping to the Child object reference for the Multiplicity.

Can somebody please suggest how to achieve this...???

I have tried using all the CascadeType attributes but all the effort went in vain.

Thanks In Advance,
Manjith Kumar.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.