-->
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.  [ 3 posts ] 
Author Message
 Post subject: MappingException: Unable to find column with logical name
PostPosted: Sun Jan 14, 2007 4:30 pm 
Newbie

Joined: Thu Jan 04, 2007 4:40 am
Posts: 9
Hibernate version: 3.2

Name and version of the database you are using: postres 8.1

Hi,

I'm trying to apply composite-id to inheritance hierarchy. This is my situation:

EMBEDDED-ID:

public class NewId implements Serializable {

protected Long id1;
protected Long id2;

public NewId() {
}

@Column(nullable = false, unique = false)
public Long getId1() {
return this.id1;
}

public void setId(Long id1) {
this.id1 = id1;
}

@Column(nullable = false, unique = false)
public Long getId2() {
return this.sourceId2;
}

public void getSourceId(Long id2) {
this.id2 = id2;
}

.....
}

SUPERCLASS:

@Proxy(lazy=true)
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@Indexed(index=Indexable.MAINCLASS_INDEX_DIR)
@NamedQueries(value={@NamedQuery(name="mainclass.byIds", query="select m from MainClass m where m.id in (:ids)")})
public class MainClass implements Serializable, Authorable, Indexable {

protected NewId newId;

@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "id1", column = @Column(name="ID1") ),
@AttributeOverride(name = "id2", column = @Column(name="ID2") )
})
@Index(name="mainclass_idx")
public NewId getNewId() {
return this.newId;
}

public void setNewId(NewId newId) {
this.newId = newId;
}
....
}


SUBCLASS:

@Proxy(lazy=true)
@Entity
@Indexed(index=Indexable.MAINCLASS_INDEX_DIR)
@NamedQueries(value={@NamedQuery(name="subClass.byIds", query="select s from SubClass s where s.id in (:ids)")})
public class SubClass extends MainClass implements Serializable {
....
}

I get compiling:

nested exception is org.hibernate.MappingException: Unable to find column with logical name: id in org.hibernate.mapping.Table(SubClass) and its related supertables and secondary tables


Have you any idea?

Thanks,
rand


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 14, 2007 9:50 pm 
Beginner
Beginner

Joined: Tue Feb 07, 2006 10:39 pm
Posts: 46
Code:
SUPERCLASS:

@Proxy(lazy=true)
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@Indexed(index=Indexable.MAINCLASS_INDEX_DIR)
@NamedQueries(value={@NamedQuery(name="mainclass.byIds", query="select m from MainClass m where m.id in (:ids)")})
public class MainClass implements Serializable, Authorable, Indexable {


the error indicated that it can't find the 'id' as u wriiten in 'm.id'. Have u assigned object 'id'??


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 2:12 am 
Newbie

Joined: Thu Jan 04, 2007 4:40 am
Posts: 9
faireni wrote:
@NamedQueries(value={@NamedQuery(name="mainclass.byIds", query="select m from MainClass m where m.id in (:ids)")})

the error indicated that it can't find the 'id' as u wriiten in 'm.id'. Have u assigned object 'id'??


No. How can I do it? How can I reference directly for composite-id?

Thanks,
rand


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.