These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Can we override the fetching methods of hibernate
PostPosted: Mon Oct 09, 2006 3:23 am 
Newbie

Joined: Thu Aug 17, 2006 1:33 am
Posts: 3
Location: India
Hi All,
I need help in hibernate related issue. I need to override the method which used by hibernate api to fetch children records. Scenario: I have declared set in hibernate xml file.
<set name="messages" cascade="delete" inverse="true" lazy="true">
<key column="topic_id"/>
<one-to-many class="com.common.data.bulletinboard.MessageData"/>
</set>

Parent : Topic
Child set : Messages.
Hibernate version:[3.0]

While fetching messages through lazy loading, I need to convert some date fields to user defined timezone. Which method I have to override in order to perform action which would be reflected in child records.

Thanks in Advance

Regards
Chauhan[/b]

Sorry Friends.
I didn't write my requirment completly. In my application, I am using Sping,JSTL and hibernate. After putting topicData in model at server side , we can access same through JSTL in JSP. like "
<c:set var="topicData" value="${topicData}"/>
Any field like
<c:out value="${topicData.name}"/>

<c:out value="${topicData.messages}"/> returns collection of child set i.e. messages which are fetched by hibernate by lazy loading. I want to perform some check/action while fetching these records i.e. messages. I have to set timezone in all date field in messages with respect to user timezone. Where I can set all date fields in message child object wrt timezone.

Thanks in Advance

Regards
Chauhan


Last edited by chauhan2222 on Tue Oct 10, 2006 1:41 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 09, 2006 9:55 pm 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
Chauhan2222,

I do not know the answer to your question, but why can't you do the date postprocessing after you obtain your data from Hibernate?

Marius


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 10, 2006 1:21 am 
Beginner
Beginner

Joined: Thu Oct 06, 2005 8:14 pm
Posts: 23
We have overridden some listeners in hibernate
you have some mergeEventListeners or updateEventListeners just check which type you will need to override..
Works fine..
Priya
(p.s don't forget to give me some credits)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.