-->
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.  [ 7 posts ] 
Author Message
 Post subject: problems with view
PostPosted: Wed Sep 09, 2009 5:58 am 
Beginner
Beginner

Joined: Sat Aug 01, 2009 5:28 am
Posts: 42
hi to all,
in our application view were created on runtime.
now we are migrating to hibernate.now what should i do,because if view were created on runtime how could i have a mapping class for it......

_________________
Warm Regards,
Tarun Walia


Top
 Profile  
 
 Post subject: Re: problems with view
PostPosted: Wed Sep 09, 2009 8:28 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
You can map to a view, but you still need to know the view name and the columns. There's no easy way to do that dynamically at runtime.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: problems with view
PostPosted: Wed Sep 09, 2009 3:55 pm 
Regular
Regular

Joined: Mon Jan 05, 2009 6:42 pm
Posts: 99
Location: IL
Hello Tarun,
what does the database view do for you? are you planning on to use it for Reporting purpose only? I mean just for read only purposes? Also what will be items you know for sure for the view that is going to be created at Runtime?

-Srilatha.


Top
 Profile  
 
 Post subject: Re: problems with view
PostPosted: Fri Sep 11, 2009 4:58 am 
Beginner
Beginner

Joined: Sat Aug 01, 2009 5:28 am
Posts: 42
thanks.yes we are creating views just for reporting purpose,but these views are dynamic.i have no information before.

_________________
Warm Regards,
Tarun Walia


Top
 Profile  
 
 Post subject: Re: problems with view
PostPosted: Fri Sep 11, 2009 12:27 pm 
Regular
Regular

Joined: Mon Jan 05, 2009 6:42 pm
Posts: 99
Location: IL
Hello Tarun,
even if the views are dynamic, if you know what columns its going to have and the names of them should be good enough i guess. You don't need a mapping file. All you need is a POJO with attributes named same as Database View column names and generic datatypes defined. Then you can use a ResultSetTransformer to load the data into the POJO.

Hope this helps,
Srilatha.


Top
 Profile  
 
 Post subject: Re: problems with view
PostPosted: Mon Sep 14, 2009 2:43 am 
Beginner
Beginner

Joined: Sat Aug 01, 2009 5:28 am
Posts: 42
Thanks latha,now I am able to do with ResultSetTransformer,but is there any solution if i dont know the column attribute before.

I tried by generating class at run time using BCEL but got no succsess.is there any other way

_________________
Warm Regards,
Tarun Walia


Top
 Profile  
 
 Post subject: Re: problems with view
PostPosted: Tue Sep 15, 2009 11:36 am 
Regular
Regular

Joined: Mon Jan 05, 2009 6:42 pm
Posts: 99
Location: IL
Hi Tarun,
I was searching online after your post.. I was looking for anything that I can find to match your need. Nothing so far. Here is a link with some hints but nothing concrete.
http://docs.jboss.org/hibernate/stable/ ... asses.html
Please post us back and let us know if you find anything.

Sorry could not be of any help,
Srilatha.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.