Hi,

This has nothing to do with Tapestry.

You have 2 options:
1) Use the @Column annotation on the _id field
@Id @GeneratedValue @Column(name="id") 
private Long _id;

2) Annotate the accessor methods


/Serge



Bill Holloway wrote:
> 
> To use the simplified page activation context for a hibernate entity
> page (e.g., onActivate(Person p)...), it looks like the entity class'
> primary key id field's name must match VERBATIM the text that follows
> the word "get" in the getter (and "set" in the setter, probably).
> 
> I.e., this won't work:
> 
> @Id @GeneratedValue
> private Long _id;
> 
> public Long getId()....
> 
> This fails because getId is not named get_id.  I normally use
> underscore prefixes for my instance variables.  This is failing in
> HibernateEntityValueEncoder on this line:
> 
> propertyAdapter =
> propertyAccess.getAdapter(this.entityClass).getPropertyAdapter(idPropertyName);
> 
> It looks for an idPropertyName "_id" and doesn't find one because
> according to the getter/setter pattern, the name is "id".  The
> propertyAdapter is then null which throws an NPE on line 79:
> 
> Object id = typeCoercer.coerce(clientValue, propertyAdapter.getType());
> 
> Bill in Austin
> 
> -- 
> Without coding you have no product
> Without testing, no quality
> Without refactoring, no future
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5%2BHibernate%3A-Entity-class-id-variables-cannot-have-leading-underscores-tp20523653p20527276.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to