-->
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: Query language substitutions: {} fails
PostPosted: Mon Jan 12, 2004 6:53 am 
Newbie

Joined: Wed Jan 07, 2004 8:10 am
Posts: 8
I get the below error message when I un my test harness.
Can someone tell me what it is that I am doing wrong?

**************** Error Message ***************
INFO: Query language substitutions: {}
F
Time: 4.578
There was 1 failure:
1) test0001Load(com.db.gcp.lem.cds.test.data.DocTypeDAOTest)junit.framework.AssertionFailedError: expected:<1> but was:<0>
at com.db.gcp.lem.cds.test.data.DocTypeDAOTest.test0001Load(DocTypeDAOTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.db.gcp.lem.cds.test.data.DocTypeDAOTest.main(DocTypeDAOTest.java:19)

***************** Test Stub *******************
public class DocTypeDAOTest extends CDSHibernateTestBase{

private static Class CLASS = DocTypeDAOTest.class;

public static void main(String[] args)
{
String[] arr = {CLASS.getName()};
junit.textui.TestRunner.main(arr);
}

public void test0001Load() throws Exception {
assertNotNull(hibernateSession);
Query q = hibernateSession.createQuery("from com.db.gcp.lem.cds.data.DocTypeDAO doctype where doctype.documentationTypeID = :documentationTypeID") ;
q.setParameter("documentationTypeID",new Long(10000)) ;
assertEquals(1,q.list().size());
}
}


********* Data Access Object **************
package com.db.gcp.lem.cds.data;

import java.io.Serializable;


/**
* @author Mehran Zonouzi
* Date: 06-Jan-2004
* Time: 12:30:43
*/

/**
* @hibernate.class
* table="REFdocumentationtype"
* mutable="false"
* @hibernate.query
* name="getDocTypeQuery"
* query="from DocTypeDAO doctype where doctype.documentationTypeID = ?"
*/

public class DocTypeDAO implements Serializable
{

private Long documentationTypeID;

/**
* @hibernate.id
* column="DOCUMENTATIONTYPEID"
* generator-class="sequence"
* @hibernate.generator-param
* name="sequence"
* value="seq_doctype"
*/

public Long getDocumentationTypeID()
{
return documentationTypeID;
}

public void setDocumentationTypeID(Long documentationTypeID)
{
this.documentationTypeID = documentationTypeID;
}

private String description;

/**
* @hibernate.property coulmn="DESCRIPTION"
*/

public String getDescription()
{
return description;
}

public void setDescription(String description)
{
this.description = description;
}

private Double entryOrder;

/**
* @hibernate.property coulmn="ENTRYORDER"
*/

public Double getEntryOrder()
{
return entryOrder;
}

public void setEntryOrder(Double entryOrder)
{
this.entryOrder = entryOrder;
}

private String defaultInd;

/**
* @hibernate.property coulmn="DEFAULTIND"
*/

public String getDefaultInd()
{
return defaultInd;
}

public void setDefaultInd(String defaultInd)
{
this.defaultInd = defaultInd;
}

private String modifyDefaultInd;

/**
* @hibernate.property coulmn="MODIFYDEFAULTIND"
*/

public String getModifyDefaultInd()
{
return modifyDefaultInd;
}

public void setModifyDefaultInd(String modifyDefaultInd)
{
this.modifyDefaultInd = modifyDefaultInd;
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 12, 2004 8:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Can't see any problem here. Look if the SQL hibernate generates produce proper result when executed manually. Are you sure you actually have the data in your database?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 12, 2004 10:41 am 
Newbie

Joined: Wed Jan 07, 2004 8:10 am
Posts: 8
You are right. There is no data in the database for that record.
I was pointing to wrong database in my code.


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.