-->
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.  [ 5 posts ] 
Author Message
 Post subject: Relationship mapping
PostPosted: Tue Dec 27, 2005 8:16 am 
Newbie

Joined: Wed Dec 21, 2005 4:03 pm
Posts: 7
Location: Brazil - Fortaleza
Hello there,

I have a problem to map a column ! My code :
[code] public void setName(String Name)

{

this.Name = Name;

}


@Column(name = "NAME", nullable = false, length=150)

public String getName()

{

return Name;

}[/code]

In the data base, there is a column NAME. However, that doesn't work !!

Throws :
[code]org.hibernate.QueryException: could not resolve property: Name of: Person [SELECT p.Name FROM Person p ]
at org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(AbstractPropertyMapping.java:43)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:37)
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 27, 2005 8:27 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Just read _any_ documentation, please.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 27, 2005 9:12 am 
Newbie

Joined: Wed Dec 21, 2005 4:03 pm
Posts: 7
Location: Brazil - Fortaleza
[quote="christian"]Just read _any_ documentation, please.[/quote]

I already read !!!
[quote]
This annotation can be applied to regular properties as well as @Id or @Version properties.
@Column(
name="columnName"; (1)
boolean unique() default false; (2)
boolean nullable() default true; (3)
boolean insertable() default true; (4)
boolean updatable() default true; (5)
String columnDefinition() default ""; (6)
String secondaryTable() default ""; (7)
int length() default 255; (8)
int precision() default 0; // decimal precision (9)
int scale() default 0; // decimal scale

(1) name (optional): the column name (default to the property name)
[/quote]

why @Column(name = "NAME", nullable = false, length=150) doesn't work ??

thanks advance


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 27, 2005 10:02 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
The name of the property is "name", not "Name".


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 27, 2005 10:40 am 
Newbie

Joined: Wed Dec 21, 2005 4:03 pm
Posts: 7
Location: Brazil - Fortaleza
[quote="christian"]The name of the property is "name", not "Name".[/quote]

thanks !!


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