-->
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: Does hibernate3.0 supports Views and Stored procedures
PostPosted: Thu Jun 02, 2005 7:31 am 
Newbie

Joined: Mon Apr 19, 2004 10:12 am
Posts: 19
Location: India
Can any one help me in regard that does hibernate3.0 supports Stored procedures and Views ?

Thanks in advance

_________________
Ravi Kumar


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 02, 2005 8:00 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi

I haved used views in hibernate 2.1.8 itself

Create a POJO class for view and then write a mapping file for it.

that it for view.

If anybody have anyother idea of using views let me know?

sorry I haven't used Stored procedures.

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 02, 2005 11:54 am 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
For views, as said above, just write a mapping file for them. However, you'll have to ensure that you have some sort of way to disinguish unique rows from the view.

And if you define your PK on the view make sure it doesn't contain a nullable column.

We had to map to some nasty external db via a view and they didn't expose a very good key for us (all of the columns were nullable). During one of the upgrades of Hibernate the functionality changed so that if any part of your key was null then it treated the whole row as null. Just something to be wary of.

As for the stored procs, check out
17.3.2. Using stored procedures for querying
in the reference docs.

You can also obtain a connection directly via JDBC and then execute your stored proc directly.

i.e.

Code:
Connection connection = session.connection();
        CallableStatement statement = null;
        try {
            statement = connection.prepareCall("{ call dbms_wm.GotoWorkspace(?) }");
            statement.setString(1, workspace);
            statement.execute();
        } finally {
            closeStatement(statement);
        }


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.