Re: T5: Tapestry, Hibernate and Underscores.

2007-10-15 Thread Davor Hrg
maybe you missed the point here,

never mind the reason I use the _ prefix ..
the problem was with hibernate, not with tapestry

Davor Hrg

On 10/15/07, Christian Gruber [EMAIL PROTECTED] wrote:

 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]




Re: T5: Tapestry, Hibernate and Underscores.

2007-10-15 Thread Christian Gruber
I did not.  The problem was not with hibernate.  The problem was that  
you used hibernate annotations (JPA annotations, actually) in a way  
other than their documented intent.  If you annotate a field _foo,  
then the property name will be _foo according to hibernate, regardless  
of accessors.  You can override the automatic column designation with  
@Column but by default, it'll look for a column named _foo.  You can  
also solve it by either annotating the getter (as mentioned  
elsewhere), or by renaming your variable to not use the _.  Where am I  
misunderstanding?  My comments about tapestry were only that you could  
avoid using _foo style and tapestry would continue to work.


Anyway, this is a hibernate configuration question, not a tapestry  
question, so we should kill this thread on this list anyway.


Christian.

On 15-Oct-07, at 2:29 AM, Davor Hrg wrote:


maybe you missed the point here,

never mind the reason I use the _ prefix ..
the problem was with hibernate, not with tapestry

Davor Hrg

On 10/15/07, Christian Gruber [EMAIL PROTECTED] wrote:


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]





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



Re: T5: Tapestry, Hibernate and Underscores.

2007-10-14 Thread Davor Hrg
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]




Re: T5: Tapestry, Hibernate and Underscores.

2007-10-14 Thread Christian Gruber
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]



Re: T5: Tapestry, Hibernate and Underscores.

2007-10-13 Thread lasitha
Hi oliver,  hibernate is pretty well documented... :)
http://www.hibernate.org/hib_docs/v3/reference/en/html/session-configuration.html#configuration-namingstrategy
Cheers, lasitha.

On 10/13/07, Olivier [EMAIL PROTECTED] wrote:

 But that would mean I have to map each and every column. I was actually
 looking for a way to tell hibernate: Hey, all my class properties are
 prefixed with an underscore but my db columns are not.. Is something like
 that possible?

 On Fri, 12 Oct 2007 09:51:20 -0700, Josh Canfield [EMAIL PROTECTED]
 wrote:
  You can explicitly tell hibernate the names of your columns using
 hibernate
  annotations or your hibernate mapping files. You'll need to check with
 the
  hibernate docs/lists for more details.
 
  Josh
 
 
  On 10/12/07, Olivier [EMAIL PROTECTED] 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]
 
 
 
 
  --
  --
  TheDailyTube.com. Sign up and get the best new videos on the internet
  delivered fresh to your inbox.


 -
 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]



Re: T5: Tapestry, Hibernate and Underscores.

2007-10-13 Thread Angelo Chen

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]



Re: T5: Tapestry, Hibernate and Underscores.

2007-10-12 Thread Josh Canfield
You can explicitly tell hibernate the names of your columns using hibernate
annotations or your hibernate mapping files. You'll need to check with the
hibernate docs/lists for more details.

Josh


On 10/12/07, Olivier [EMAIL PROTECTED] 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]




-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.