-->
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: @OneToMany or @ManyToMany targeting an unmapped class:
PostPosted: Wed May 07, 2014 8:30 am 
Newbie

Joined: Wed May 07, 2014 8:20 am
Posts: 1
Hi,

I created two different classes with OneToMany relationship but while executing this code I am getting one error like

... 63 more
Caused by: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: QuoteSync.quoteSyncLineItemsSet[QuoteSyncLineItems]
at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1071)
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:602)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:543)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1177)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:329)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1162)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:717)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 70 more


Please help me on this. Where I made mistake



import java.io.Serializable;
import java.sql.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import com.cat.solar.wp.action.common.CommonConstants;


@Entity
@Table(name="WP_QUOTE_SYNC_STATUS",schema=CommonConstants.SCHEMA_NAME)
public class QuoteSync implements Serializable {

/** TODO Update comment for serialVersionUID. */
private static final long serialVersionUID = -4520020666687496320L;

private Integer id = null;
private Set<QuoteSyncLineItems> quoteSyncLineItemsSet=null;

@Id
@SequenceGenerator(name="idGenerator",sequenceName=CommonConstants.SCHEMA_NAME+".WP_QUOTE_SYNC_STATUS_SEQ")
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="idGenerator")
@Column(name="ID")
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}



@OneToMany(mappedBy="quoteSync")
public Set<QuoteSyncLineItems> getQuoteSyncLineItemsSet() {
return quoteSyncLineItemsSet;
}
public void setQuoteSyncLineItemsList(
Set<QuoteSyncLineItems> quoteSyncLineItemsSet) {
this.quoteSyncLineItemsSet = quoteSyncLineItemsSet;
}

}

}



-------------------------------------------------

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Entity;

@Entity
@Table(name="WP_QUOTE_SYNC_STATUS_LINE", schema=CommonConstants.SCHEMA_NAME)
public class QuoteSyncLineItems {


private Integer syncStatusLineId = null;

private QuoteSync quoteSync = null;

@Id
@SequenceGenerator(name="idGen", schema=CommonConstants.SCHEMA_NAME+".WP_QUOTE_SYNC_STATUS_LINE_SEQ")
@GeneratedValue(generator="idGen",strategy=GenerationType.SEQUENCE)
@Column(name="ID")
public Integer getSyncStatusLineId() {
return syncStatusLineId;
}
public void setSyncStatusLineId(Integer syncStatusLineId) {
this.syncStatusLineId = syncStatusLineId;
}



@ManyToOne
@JoinColumn(name ="WP_QUOTE_SYNC_STATUS_ID")
public QuoteSync getQuoteSync() {
return quoteSync;
}
public void setQuoteSync(QuoteSync quoteSync) {
this.quoteSync = quoteSync;
}


}


Top
 Profile  
 
 Post subject: Re: @OneToMany or @ManyToMany targeting an unmapped class:
PostPosted: Wed May 28, 2014 1:38 am 
Newbie

Joined: Wed May 28, 2014 1:32 am
Posts: 1
Use import javax.persistence.Entity; instead of org.hibernate.annotations.Entity in your QuoteSyncLineItems class


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.