-->
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: OneToOne and JoinColumn confusion
PostPosted: Wed Apr 25, 2007 2:30 pm 
Beginner
Beginner

Joined: Wed Oct 29, 2003 10:43 am
Posts: 38
Location: Chicago
I have two annotated classes:


@Entity
@IdClass( SkulPopulationRelationshipEndNodePk.class )
@Table( name = "skul_pop_rel_end" )
public class SkulPopulationRelationshipEndNode extends SkulPopulationRelationshipEndNodeBase
{
@Id
private Integer skulNumber;

@Id
private Integer edgeSkulNumber;

@Column( name="edge_type", precision=1 )
private Byte edgeType;

@OneToOne
@LazyToOne( LazyToOneOption.NO_PROXY )
@JoinColumn( name="edge_skul_no",
referencedColumnName="skul_no",
insertable=false,
updatable=false )
@NotFound( action=NotFoundAction.IGNORE )
private OptimizedResultsMeo edgeOptimizedResultsMeo;
}

public class OptimizedResultsMeo implements Serializable
{
@Id
@Column( name="skul_no", length=7 )
private Integer skulNumber;

@Column( name="item_no", length=65 )
protected String itemNumber;
}

Here is the PK class for SkulPopulationRelationshipEndNode:
@Embeddable
public class SkulPopulationRelationshipEndNodePk extends SkulPopulationRelationshipEndNodeBase
{
@Column( name="skul_no", precision=8, scale=0 )
private Integer skulNumber;

@Column( name="edge_skul_no", precision=8, scale=0 )
private Integer edgeSkulNumber;
}

I want to create OneToOne link:
SkulPopulationRelationshipEndNodeBase.edgeSkulNUmber -> OptimizedResultsMeo.skulNumber

I get the following exception when i try to load these 2 classes:

org.hibernate.MappingException: broken column mapping for: edgeOptimizedResultsMeo.id of: net.gainsystems.common.clientserverbatch.hibernate.skul.grouping.SkulPopulationRelationshipEndNode
at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:121)
at org.hibernate.persister.entity.AbstractPropertyMapping.initIdentifierPropertyPaths(AbstractPropertyMapping.java:177)
at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:159)
at org.hibernate.persister.entity.AbstractEntityPersister.initOrdinaryPropertyPaths(AbstractEntityPersister.java:1708)
at org.hibernate.persister.entity.AbstractEntityPersister.initPropertyPaths(AbstractEntityPersister.java:1738)
at org.hibernate.persister.entity.AbstractEntityPersister.postConstruct(AbstractEntityPersister.java:2914)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:409)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
at net.gainsystems.common.serverbatch.hibernate.HibernateSessionFactory.<init>(HibernateSessionFactory.java:226)


Can anyone point out what changes I have to make to fix this relationship?

_________________
LET IT BE :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 29, 2007 3:47 am 
Newbie

Joined: Sun Apr 22, 2007 12:57 am
Posts: 7
The OneToOne mapping you have is actually ManyToOne. Simply change @OneToOne to @ManyToOne and it will work.


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.