Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-05-2007, 02:51 AM
Member
 
Join Date: May 2007
Posts: 39
Alan is on a distinguished road
Hibernate
I have the follow problem with hibernate when I want to get data from db.

the methods are :

public static List getModulos(String idProject,Long[] modulosID){
Session session = SEPhibernate.getSessionFactory().getCurrentSession ();
session.beginTransaction();
ModulosDAO dao = new ModulosDAO(session);
List modulos=null;
try {
modulos = dao.getModulos(idProject,modulosID);
}
catch (Exception ex) {
ex.printStackTrace();
}
session.close();
return modulos;
}

public List getModulos(String project,Long[] modulosID) throws HibernateException {

Query query = session.createQuery("select M.name FROM Model.Module M where M.project.id="+project+" and M.id in (:modulosID) order by M.name")
.setParameterList("modulosID",modulosID);
return query.list();
}

it works ok, but when I reuse the methods with other values, it doesn´t get me anything

what can I do?

Last edited by Alan : 06-01-2007 at 03:37 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-06-2007, 09:41 AM
Senior Member
 
Join Date: Mar 2007
Posts: 136
goldhouse is on a distinguished road
Is your secondary level cache enabled ? Disable and try
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-11-2007, 03:19 AM
Member
 
Join Date: May 2007
Posts: 42
Freddie is on a distinguished road
First, use parameters for all the parameters,don't join the project there in the query, do like list (only that you use setParameter instead of etParameterList). Anyway it isn't your problem.
Also you shoud handle the transaction, notice that your open it but you never close it
read this:
HIBERNATE - Relational Persistence for Idiomatic Java
regards

Last edited by Freddie : 06-01-2007 at 04:33 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hibernate, help me Nick15 Database 2 06-05-2008 05:39 PM
Hibernate sql query taicode Database 0 03-25-2008 06:17 PM
question about hibernate bbq Database 1 07-09-2007 06:04 AM
org.hibernate.ejb.Version <clinit> INFO: Hibernate EntityManager 3.2.0.CR1 Heather Database 2 06-30-2007 05:01 PM
Hibernate Shuru Database 2 05-09-2007 07:39 PM


All times are GMT +3. The time now is 02:05 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org