Tapestry doesn't require _ prefixes, mind you. That's a Howard M. Lewis Ship-ism. (actually, I have it too from my NeXTSTEP days.) It's not mandatory, however, so on your persistent objects, you could use the typical pattern and annotate your properties, if that's how you want to do it. Tapestry will (it seems) do its magic on properties taht are annotated regardless of their prefix, because it's the annotation that matters, not the variable name.

Christian.

On 14-Oct-07, at 4:17 PM, Davor Hrg wrote:

hi,

I've tried to adopt underscores for private fields,
so the the tutorial got mixed when I've created that page with AngeloChen.

I'll check tomorow if this is true, but I belive you
can avoid this problem by not putting annotations
on the fields and putting them on the getters or setters instead

@Id
private long _id;

public getId()...
public setId()...

in this example hibernate will see annotation on the field
and see it as _id

if you change the code to

private long _id;

@Id
public getId()...
public setId()...

in this example hibernate will see annotation on the getter
and see it as id when "get" is stripped

!Beware. if you put annotations both on fields and getters
hibernate will loose some of them


I'll find some time and fix the code to adopt one convention

Davor Hrg






On 10/13/07, Angelo Chen <[EMAIL PROTECTED]> wrote:


Hi Olivier,

In that tutorial the only place with underscore is _session, the entities for hibernate do not have underscore, I prefer this way, it looks normal when u do some sql/hql queries, but for Tapestry variables ,seems to me, a
unspoken rule here is to prefix underscore.

A.C.


Olivier-36 wrote:


Hi,


I followed the small tutorial on using hibernate with T5 here
http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryHibernate and
it
worked like a charm. Thank you to whoever wrote this!

The example uses underscores for some private fields and sometimes not.
Now
I want to use this in my entities but then Hibernate generates incorrect
column names. Isn't there a way for tuning this in the configuration
file
or something? If someone has that info, please share it with me!


Thank you in advance,
Olivier



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




--
View this message in context:
http://www.nabble.com/T5%3A-Tapestry%2C-Hibernate-and-Underscores.-tf4614534.html#a13188869
Sent from the Tapestry - User mailing list archive at Nabble.com.


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




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

Reply via email to