You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bojan Cincur <bl...@gmail.com> on 2009/12/06 13:19:02 UTC

Tapestry - hibernate problem

Hi all,

I have a little problem.

I'm using hibernate criteria to fetch list of objects that I want to display
in loop component. (enclosed in my commentModule component)

Criteria criteria = getManager().createCriteria(CommentBean.class);
criteria.setFetchMode("user",FetchMode.JOIN);

this criteria should return list of commentBean objects and associated user
object (as said in hibernate documentation),

BUT

when i call in loop element comment.user.username to optain username of user
that posted comment I get this error:

Render queue error in Expansion[PropBinding[expansion
collaborators/Details:commentsmodule(comment.user.username)]]: Property
'user' (within property expression 'comment.user.username', of
me.xxx.xxx.components.CommentsModule@eaabad) is null.

I tried all sorts of thing but I'm not sure what to do next... Is this
problem with tapestry and is there some sort of work around?


-- 
Bojan Ćinćur
email blueboy6@gmail.com
Skype bojan.cincur

Re: Tapestry - hibernate problem

Posted by Christian Riedel <ch...@gmx.net>.
Hi,
Looks more like an issue with your criteria. Have you tried to use 
FetchMode.EAGER instead?

Christian



Bojan Cincur schrieb:
> Hi all,
>
> I have a little problem.
>
> I'm using hibernate criteria to fetch list of objects that I want to display
> in loop component. (enclosed in my commentModule component)
>
> Criteria criteria = getManager().createCriteria(CommentBean.class);
> criteria.setFetchMode("user",FetchMode.JOIN);
>
> this criteria should return list of commentBean objects and associated user
> object (as said in hibernate documentation),
>
> BUT
>
> when i call in loop element comment.user.username to optain username of user
> that posted comment I get this error:
>
> Render queue error in Expansion[PropBinding[expansion
> collaborators/Details:commentsmodule(comment.user.username)]]: Property
> 'user' (within property expression 'comment.user.username', of
> me.xxx.xxx.components.CommentsModule@eaabad) is null.
>
> I tried all sorts of thing but I'm not sure what to do next... Is this
> problem with tapestry and is there some sort of work around?
>
>
>   

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


Re: Tapestry - hibernate problem

Posted by Josh Canfield <jo...@thedailytube.com>.
The session isn't closed until you are leaving the request, after your
template has rendered. The problem is most likely with your query or
your data. Try accessing the values from your component class and you
should see that it's still null.

You should also enable logging for hibernate to see exactly what it's
loading and what query it's running.

if you're using log4j.properties you can try these:

log4j.category.org.hibernate.type=trace
log4j.category.org.hibernate.cache=trace
log4j.category.org.hibernate.SQL=debug

and these to your hibernate properties.

hibernate.show_sql=true
hibernate.format_sql=true

Josh

On Sun, Dec 6, 2009 at 9:37 AM, blueboy6 <bl...@gmail.com> wrote:
>
> My mapping are ok, because yesterday I used eager fetching on all collections
> and it worked, I just removed every eager mappings and create criteria for
> all one level criteria, problem is when I try to go deeper...
>
> It seams that problem is that session is closed when I try to fetch data...
> It seeams that tapestry is closing hibernate sessions automatically.
>
> Someone told me to implement open session in view... Any suggestion about
> that matter?
>
> Tnx for your fast answers :)
>
>
> bouil wrote:
>>
>> Hi,
>>
>> You should check your mapping to be sure the many-to-one relationship
>> between "comment" and "user" is correct, and verify your database table
>> "comment" contains an existing foreign key to the user table.
>>
>> Best thing to do is to run your Criteria in a JUnit test.
>>
>> Nicolas.
>>
>>
>> Bojan Cincur a écrit :
>>> Hi all,
>>>
>>> I have a little problem.
>>>
>>> I'm using hibernate criteria to fetch list of objects that I want to
>>> display
>>> in loop component. (enclosed in my commentModule component)
>>>
>>> Criteria criteria = getManager().createCriteria(CommentBean.class);
>>> criteria.setFetchMode("user",FetchMode.JOIN);
>>>
>>> this criteria should return list of commentBean objects and associated
>>> user
>>> object (as said in hibernate documentation),
>>>
>>> BUT
>>>
>>> when i call in loop element comment.user.username to optain username of
>>> user
>>> that posted comment I get this error:
>>>
>>> Render queue error in Expansion[PropBinding[expansion
>>> collaborators/Details:commentsmodule(comment.user.username)]]: Property
>>> 'user' (within property expression 'comment.user.username', of
>>> me.xxx.xxx.components.CommentsModule@eaabad) is null.
>>>
>>> I tried all sorts of thing but I'm not sure what to do next... Is this
>>> problem with tapestry and is there some sort of work around?
>>>
>>>
>>
>>
>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Tapestry---hibernate-problem-tp26664444p26667111.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



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

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


Re: Tapestry - hibernate problem

Posted by blueboy6 <bl...@gmail.com>.
My mapping are ok, because yesterday I used eager fetching on all collections
and it worked, I just removed every eager mappings and create criteria for
all one level criteria, problem is when I try to go deeper...

It seams that problem is that session is closed when I try to fetch data...
It seeams that tapestry is closing hibernate sessions automatically. 

Someone told me to implement open session in view... Any suggestion about
that matter? 

Tnx for your fast answers :)


bouil wrote:
> 
> Hi,
> 
> You should check your mapping to be sure the many-to-one relationship 
> between "comment" and "user" is correct, and verify your database table 
> "comment" contains an existing foreign key to the user table.
> 
> Best thing to do is to run your Criteria in a JUnit test.
> 
> Nicolas.
> 
> 
> Bojan Cincur a écrit :
>> Hi all,
>> 
>> I have a little problem.
>> 
>> I'm using hibernate criteria to fetch list of objects that I want to
>> display
>> in loop component. (enclosed in my commentModule component)
>> 
>> Criteria criteria = getManager().createCriteria(CommentBean.class);
>> criteria.setFetchMode("user",FetchMode.JOIN);
>> 
>> this criteria should return list of commentBean objects and associated
>> user
>> object (as said in hibernate documentation),
>> 
>> BUT
>> 
>> when i call in loop element comment.user.username to optain username of
>> user
>> that posted comment I get this error:
>> 
>> Render queue error in Expansion[PropBinding[expansion
>> collaborators/Details:commentsmodule(comment.user.username)]]: Property
>> 'user' (within property expression 'comment.user.username', of
>> me.xxx.xxx.components.CommentsModule@eaabad) is null.
>> 
>> I tried all sorts of thing but I'm not sure what to do next... Is this
>> problem with tapestry and is there some sort of work around?
>> 
>> 
> 
> 
> 
>  
> 

-- 
View this message in context: http://old.nabble.com/Tapestry---hibernate-problem-tp26664444p26667111.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Tapestry - hibernate problem

Posted by Nicolas Bouillon <ni...@bouil.org>.
Hi,

You should check your mapping to be sure the many-to-one relationship 
between "comment" and "user" is correct, and verify your database table 
"comment" contains an existing foreign key to the user table.

Best thing to do is to run your Criteria in a JUnit test.

Nicolas.


Bojan Cincur a écrit :
> Hi all,
> 
> I have a little problem.
> 
> I'm using hibernate criteria to fetch list of objects that I want to display
> in loop component. (enclosed in my commentModule component)
> 
> Criteria criteria = getManager().createCriteria(CommentBean.class);
> criteria.setFetchMode("user",FetchMode.JOIN);
> 
> this criteria should return list of commentBean objects and associated user
> object (as said in hibernate documentation),
> 
> BUT
> 
> when i call in loop element comment.user.username to optain username of user
> that posted comment I get this error:
> 
> Render queue error in Expansion[PropBinding[expansion
> collaborators/Details:commentsmodule(comment.user.username)]]: Property
> 'user' (within property expression 'comment.user.username', of
> me.xxx.xxx.components.CommentsModule@eaabad) is null.
> 
> I tried all sorts of thing but I'm not sure what to do next... Is this
> problem with tapestry and is there some sort of work around?
> 
>