-->
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.  [ 2 posts ] 
Author Message
 Post subject: Trouble in the mapping
PostPosted: Tue Oct 26, 2010 4:23 am 
Newbie

Joined: Tue Oct 26, 2010 3:22 am
Posts: 1
Hello, I have next trouble:
in the of mapping class, hibernate create table:

CREATE
TABLE movie_media_asset
(
movie_id BIGINT NOT NULL,
promotrailers_id BIGINT NOT NULL,
previews_id BIGINT NOT NULL,
PRIMARY KEY (movie_id, previews_id),
CONSTRAINT fk519177e62df3f0da FOREIGN KEY (movie_id) REFERENCES public.movie (id),
CONSTRAINT fk519177e6892787b FOREIGN KEY (previews_id) REFERENCES public.media_asset (id),
CONSTRAINT fk519177e6e991c3f7 FOREIGN KEY (promotrailers_id) REFERENCES public.media_asset
(id),
UNIQUE (promotrailers_id),
UNIQUE (previews_id)
)

How I can this trouble get round??? Help me, please

Source code:

public class Movie extends implements java.io.Serializable
{

private java.util.Set < MediaAsset > previews = new java.util.TreeSet < MediaAsset >();
private java.util.Set < MediaAsset > promoTrailers = new java.util.TreeSet < MediaAsset > ();

// ------------- Relations ------------------

/**
* Get the previews Collection
*
* @return java.util.Set<MediaAsset>
*/
@javax.persistence.OneToMany(fetch = javax.persistence.FetchType.LAZY)
public java.util.Set < MediaAsset > getPreviews() {
return this.previews;
}

/**
* Set the previews
*
* @param previews
*/
public void setPreviews(java.util.Set < MediaAsset > previews) {
this.previews = previews;
}

/**
* Add MediaAsset
*
* @param mediaAsset
*/

public void addToPreviews(MediaAsset mediaAsset) {
if (mediaAsset == null)
return;
this.getPreviews().add(mediaAsset);
}

/**
* Remove MediaAsset
*
* @param mediaAsset
*/

public void removeFromPreviews(MediaAsset mediaAsset) {
if (mediaAsset == null)
return;
this.getPreviews().remove(mediaAsset);
}

/**
* Get the promoTrailers Collection
*
* @return java.util.Set<MediaAsset>
*/
@javax.persistence.OneToMany(fetch = javax.persistence.FetchType.LAZY)
public java.util.Set < MediaAsset > getPromoTrailers() {
return this.promoTrailers;
}

/**
* Set the promoTrailers
*
* @param promoTrailers
*/
public void setPromoTrailers(java.util.Set < MediaAsset > promoTrailers) {
this.promoTrailers = promoTrailers;
}

/**
* Add MediaAsset
*
* @param mediaAsset
*/

public void addToPromoTrailers(MediaAsset mediaAsset) {
if (mediaAsset == null)
return;
this.getPromoTrailers().add(mediaAsset);
}

/**
* Remove MediaAsset
*
* @param mediaAsset
*/

public void removeFromPromoTrailers(MediaAsset mediaAsset) {
if (mediaAsset == null)
return;
this.getPromoTrailers().remove(mediaAsset);
}
}

public class MediaAsset implements java.io.Serializable
{

private static final long serialVersionUID = 182342506630035664L;

// ----------- Attribute Definitions ------------

private java.lang.String fileName;
private java.lang.Long fileSize;
private java.lang.Long duration;

}


Top
 Profile  
 
 Post subject: Re: Trouble in the mapping
PostPosted: Tue Oct 26, 2010 11:54 am 
Senior
Senior

Joined: Fri Oct 08, 2010 8:44 am
Posts: 130
You forgot to describe what is your problem :D


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

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.