-->
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.  [ 6 posts ] 
Author Message
 Post subject: selects on a view
PostPosted: Fri May 20, 2005 9:37 am 
Newbie

Joined: Fri May 20, 2005 9:28 am
Posts: 4
Hello,

I'm having troubles with views. I would like to perform a select query on a view.
In results, i get a list filled of null objects. The number of null object is the right number of object i should have.
My key on the view is a composit one made of all the columns.

Here is the java part

Code:
public ArrayList getListObj(String sc) {
      
      try {
         Query query = getSession().createQuery("from Obj inv where inv.cs = :cs");
         query.setString("cs",sc);
         
         return new ArrayList(query.list());
         
      } catch (Exception e) {
         throw new DAOException( "Error getting the getListObj for cs : " + sc, e);
      }
   }


The Obj class mapps the view.

I'm using hibernate 3.0.beta4

Name and version of the database you are using:Oracle 9i

The generated SQL (show_sql=true):generated sql is ok

Thank's a lot for your help.

Pat
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 23, 2005 6:03 am 
Newbie

Joined: Fri May 20, 2005 9:28 am
Posts: 4
I upgraded hibernate to hibernate 3.0.4 to check it was not a beta problem.
I still have the same problem :(

Thank's for any return.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 8:27 am 
Newbie

Joined: Fri May 20, 2005 9:28 am
Posts: 4
Ok, this works on some views, but does not on other views on the same oracle database.

I'm still trying to understand why one works pretty well where the other one does not.

Any idea is welcome


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 9:13 am 
Newbie

Joined: Tue May 24, 2005 9:03 am
Posts: 3
Hi,

I use a view with a composite key too. One of the things I had to do was implement hashCode() and equals() on the class that maps to it. You may already be doing this, but that's the first thing that comes to mind.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 11:45 am 
Newbie

Joined: Fri May 20, 2005 9:28 am
Posts: 4
Ok, after debugging, it seems the problem is that a part of my composite key is null => returns null
As all my columns are the key in my views, that is the reason why sometimes it works and sometimes it does not.

Looking for a solution now.


Top
 Profile  
 
 Post subject: same problem
PostPosted: Wed Mar 22, 2006 9:00 am 
Beginner
Beginner

Joined: Tue Oct 07, 2003 4:32 pm
Posts: 36
Location: S
did you fix this problem ? I´m having the same problem.

thanks

Pedro


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