tapestry hibernate integration NPE

2013-05-04 Thread Jens Breitenstein

Hi All!

I detected a bug(?) in the HibernateEntityValueEncoder. When the 
hibernate entity's primary key contains an underscore in the primary key 
member name like


private Long _pk;

than the HibernateValueEncoder fails with:

Caused by: java.lang.NullPointerException
at 
org.apache.tapestry5.internal.hibernate.HibernateEntityValueEncoder.toClient(HibernateEntityValueEncoder.java:59)

at org.apache.tapestry5.corelib.components.Loop.begin(Loop.java:396)
at org.apache.tapestry5.corelib.components.Loop.beginRender(Loop.java)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.invokeComponent(ComponentPageElementImpl.java:202)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:143)



because the propertyAdapter.get method returns null for the given 
entity instance. The root cause for this is here (HibernateValueEncoder:51):


propertyAdapter = 
propertyAccess.getAdapter(this.entityClass).getPropertyAdapter(property.getName());


as property.getName returns _pk which is not in the list of adapters, 
but pk is...
The easy work around is just to rename all my pk fields, but as Tapestry 
is happy with leading underscores the hibernate integration should be too?


Is there something wrong on my side or shall I fill a jira?


Jens


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Autocomplete gotT5

2013-05-04 Thread Jens Breitenstein

Hi All!

I have two questions concerning jquery/autocomplete and hopefully one of 
you can point me to the right direction.


Part 1:

Basically everything is working fine: onProvideCompletions is called and 
the list is displayed. Unfortunately I need to render a different href 
and text in the a element. So while returning ListString 
autocomplete does the job well, I noticed the plugin supports 
JSONObjects, too.

Therefore I tried to return

ListJSONObject onProvideCompletions()

to return a different label and value.
Idea borrowed from stack overflow:
http://stackoverflow.com/questions/4536055/jquery-autocomplete-where-the-results-are-links

Thus building the object looks like:

final ListJSONObject results = new 
ArrayListJSONObject(MAX_RESULT_SIZE);

for (...) {
results.add(new JSONObject().put(value, 
linkUrl).put(label, linkTitle));

}

This results in

{
  value : http://localhost:8080/demo/url;,
  label : this is the label for demo-url
}

But only the label is rendered, still. Any hint how to change the 
rendering og a is welcome.




Part 2:

Is it possible to update a zone due to an autocomplete callback?





Thanks in advance

Jens


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



HibernateValueEncoder NPE

2013-05-04 Thread Jens Breitenstein

Hi All!

I detected a bug(?) in the HibernateEntityValueEncoder. When the 
hibernate entity's primary key contains an underscore in the primary key 
member name like


private Long _pk;

than the HibernateValueEncoder fails with:

Caused by: java.lang.NullPointerException
at 
org.apache.tapestry5.internal.hibernate.HibernateEntityValueEncoder.toClient(HibernateEntityValueEncoder.java:59)

at org.apache.tapestry5.corelib.components.Loop.begin(Loop.java:396)
at org.apache.tapestry5.corelib.components.Loop.beginRender(Loop.java)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.invokeComponent(ComponentPageElementImpl.java:202)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:143)



because the propertyAdapter.get method returns null for the given 
entity instance. The root cause for this is here (HibernateValueEncoder:51):


propertyAdapter = 
propertyAccess.getAdapter(this.entityClass).getPropertyAdapter(property.getName());


as property.getName returns _pk which is not in the list of adapters, 
but pk is...
The easy work around is just to rename all my pk fields, but as Tapestry 
is happy with leading underscores the hibernate integration should be too?


Is there something wrong on my side or shall I fill a jira?


Jens



onActivate UnknownValueException

2013-05-04 Thread Jens Breitenstein

Hi All!

I use an enum as activation context parameter. Unfortunately in case the 
enum changes or more likely the user has a typo in the url Tapestry is 
unable to coerce the url param to enum and fails by throwing an 
exception (fair enough). Instead of using onActivate parameters I 
switched to EventContext to get fine grained control here by simply 
catching the exception when coercing the enum from a given event context 
value. I wonder if there es a more elegant solution currently build in? 
If not what do you think about:


a) can't we create a new Tapestry annotation like 
CoerceExceptionDefaultsToNull or something similar to allow this 
annotation for parameters in onActivate (I know we can not limit it to 
onActivate, but...) and supress the original exception (maybe not that 
developer friendly). This introduces if (null == xyz) cascades but at 
least we won't see an exception at the client side.


or

b) a callback like Object onActivationCoercionError(final Object value, 
final Class destinationClass, final Exception e)  to make the developer 
aware of problems, allow providing a default value and Tapestry 
continues normally by calling the best fitting onActivate method afterwards?


Maybe EventContext is the route to go for proper error handling, but my 
gut feeling is we are loosing much of Tapestry's onActivation magic.

Any thoughts?

Jens


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



HibernateValueEncoder NPE

2013-05-04 Thread Jens Breitenstein

Hi All!

I detected a bug(?) in the HibernateEntityValueEncoder. When the 
hibernate entity's primary key contains an underscore in the primary key 
member name like


private Long _pk;

than the HibernateValueEncoder fails with:

Caused by: java.lang.NullPointerException
at 
org.apache.tapestry5.internal.hibernate.HibernateEntityValueEncoder.toClient(HibernateEntityValueEncoder.java:59)

at org.apache.tapestry5.corelib.components.Loop.begin(Loop.java:396)
at org.apache.tapestry5.corelib.components.Loop.beginRender(Loop.java)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.invokeComponent(ComponentPageElementImpl.java:202)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:143)



because the propertyAdapter.get method returns null for the given 
entity instance. The root cause for this is here (HibernateValueEncoder:51):


propertyAdapter = 
propertyAccess.getAdapter(this.entityClass).getPropertyAdapter(property.getName());


as property.getName returns _pk which is not in the list of adapters, 
but pk is...
The easy work around is just to rename all my pk fields, but as Tapestry 
is happy with leading underscores the hibernate integration should be too?


Is there something wrong on my side or shall I fill a jira?


Jens


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



HibernateEntityValueEncoder NPE

2013-05-04 Thread Jens Breitenstein

Hi All!

I detected a bug(?) in the HibernateEntityValueEncoder. When the 
hibernate entity's primary key contains an underscore in the primary key 
member name like


private Long _pk;

than the HibernateValueEncoder fails with:

Caused by: java.lang.NullPointerException
at 
org.apache.tapestry5.internal.hibernate.HibernateEntityValueEncoder.toClient(HibernateEntityValueEncoder.java:59)

at org.apache.tapestry5.corelib.components.Loop.begin(Loop.java:396)
at org.apache.tapestry5.corelib.components.Loop.beginRender(Loop.java)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.invokeComponent(ComponentPageElementImpl.java:202)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:143)



because the propertyAdapter.get method returns null for the given 
entity instance. The root cause for this is here 
(HibernateValueEncoder:51):


propertyAdapter = 
propertyAccess.getAdapter(this.entityClass).getPropertyAdapter(property.getName());


as property.getName returns _pk which is not in the list of adapters, 
but pk is...
The easy work around is just to rename all my _pk fields, but as 
Tapestry is happy with leading underscores the hibernate integration 
should be too?


Is there something wrong on my side or shall I fill a jira?


Jens

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Got5-JQuery auto-creates HTTP sessions needlessly

2013-05-04 Thread Lenny Primak
Default code creates HTTP sessions for every request.
Is there an easy way this could be fixed?

Issue created:
https://github.com/got5/tapestry5-jquery/issues/290

Thanks

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Got5-JQuery auto-creates HTTP sessions needlessly

2013-05-04 Thread Emmanuel DEMEY
Hi Lenny
I will have a look to your issue asap i am coming back to France ! Thx
Le 4 mai 2013 20:51, Lenny Primak lpri...@hope.nyc.ny.us a écrit :

 Default code creates HTTP sessions for every request.
 Is there an easy way this could be fixed?

 Issue created:
 https://github.com/got5/tapestry5-jquery/issues/290

 Thanks

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




HibernateValueEncoder NPE

2013-05-04 Thread Jens Breitenstein

Hi All!

I detected a bug(?) in the HibernateEntityValueEncoder. When the 
hibernate entity's primary key contains an underscore in the primary key 
member name  e.g.


private Long _pk;

than the HibernateValueEncoder fails with:

Caused by: java.lang.NullPointerException
at 
org.apache.tapestry5.internal.hibernate.HibernateEntityValueEncoder.toClient(HibernateEntityValueEncoder.java:59) 

at 
org.apache.tapestry5.corelib.components.Loop.begin(Loop.java:396) at 
org.apache.tapestry5.corelib.components.Loop.beginRender(Loop.java)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.invokeComponent(ComponentPageElementImpl.java:202) 

at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:143)


because the propertyAdapter.get method returns null for the given 
entity instance. The root cause for this is here 
(HibernateValueEncoder:51):


propertyAdapter = 
propertyAccess.getAdapter(this.entityClass).getPropertyAdapter(property.getName());


as property.getName returns _pk which is not in the list of adapters, 
but pk is... The easy work around is just to rename all my pk fields, 
but as Tapestry is happy with leading underscores the hibernate 
integration should be too?



Is there something wrong on my side or shall I fill a jira?


Jens