-->
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: Error in ORM mapping using equinox (JUnit, Hibernate, etc.
PostPosted: Mon Jan 17, 2005 7:44 am 
Newbie

Joined: Mon Jan 17, 2005 7:32 am
Posts: 13
Hi i'm using Hibernate version:2.1.7 and xdoclet-hibernate-module-1.2.2.jar.... After running my Junit test it gives weird exception. Take note that i'm using the template made by the equinox tool (AppFuse). I don't understand why it's not working though... Please help.

Mapping documents:
User.java has:


/**
* @hibernate.list lazy="true" inverse="true" cascade="all"
* @hibernate.jcs-cache usage="read-write"
* @hibernate.collection-key column="fk_owner_id"
* @hibernate.collection-index column="many_index"
* @hibernate.collection-one-to-many class="com.ssip.onlinewar.common.valueobject.UserGroupVO"
* @return List
*/
public List getCreatedUserGroups() {
return createdUserGroups;
}

public void setCreatedUserGroups(List createdUserGroups) {
this.createdUserGroups = createdUserGroups;
}



and UserGroup has the following:

/** A business entity class representing user_group.
*
* @since 1.0
* @hibernate.class table="user_group"
*/
public class UserGroupVO extends ValueObject
{
private Long userGroupId = new Long("-1");
private Long ownerId = null;
private String groupName;
//public GroupMemberVO groupMembers[];

public UserGroupVO()
{

}

/**
* @hibernate.id column="user_group_id" generator-class="native" unsaved-value="-1"
* @return
*/
public Long getUserGroupId() {
return userGroupId;
}

public void setUserGroupId(Long userGroupId) {
this.userGroupId = userGroupId;
}

/**
* @hibernate.property column="group_name" type="string"
* @return
*/
public String getGroupName() {
return groupName;
}

public void setGroupName(String groupName) {
this.groupName = groupName;
}

}




Full stack trace of any exception that occurs:
D:\myprojects\ant test
Buildfile: build.xml

compile:

test:
[junit] ERROR - Configuration.addInputStream(295) | Could not configure datastore from
input stream
[junit] java.lang.NullPointerException
[junit] at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:241)
[junit] at net.sf.hibernate.cfg.Binder.bindCollection(Binder.java:509)
[junit] at net.sf.hibernate.cfg.Binder$3.create(Binder.java:1441)
[junit] at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1028)
[junit] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:362)
[junit] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
[junit] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
[junit] at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:28
8)
[junit] at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterProperti
esSet(LocalSessionFactoryBean.java:383)
[junit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFa
ctory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1037)
[junit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFa
ctory.createBean(AbstractAutowireCapableBeanFactory.java:305)
[junit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFa
ctory.createBean(AbstractAutowireCapableBeanFactory.java:223)
[junit] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(A
bstractBeanFactory.java:236)
[junit] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(A
bstractBeanFactory.java:159)
[junit] at org.springframework.beans.factory.support.DefaultListableBeanFactory.pr
eInstantiateSingletons(DefaultListableBeanFactory.java:255)
[junit] at org.springframework.context.support.AbstractApplicationContext.refresh(
AbstractApplicationContext.java:317)
[junit] at org.springframework.context.support.ClassPathXmlApplicationContext.<ini
t>(ClassPathXmlApplicationContext.java:80)
[junit] at org.springframework.context.support.ClassPathXmlApplicationContext.<ini
t>(ClassPathXmlApplicationContext.java:65)
[junit] at com.ssip.onlinewar.data.dao.BaseDAOTestCase.<init>(BaseDAOTestCase.java
:24)
[junit] at com.ssip.onlinewar.data.dao.hibernate.AccountDAOTest.<init>(AccountDAOT
est.java:23)
[junit] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[junit] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructor
AccessorImpl.java:39)
[junit] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCon
structorAccessorImpl.java:27)
[junit] at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
[junit] at junit.framework.TestSuite.createTest(TestSuite.java:131)
[junit] at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
[junit] at junit.framework.TestSuite.<init>(TestSuite.java:75)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUn




Name and version of the database you are using: MySQL 4.1

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 18, 2005 11:49 pm 
Newbie

Joined: Mon Jan 17, 2005 7:32 am
Posts: 13
Correction. The Equinox is using hibernate version 2.1.6 and I've been using different kinds of methods like array, Set and List for my one-to-many approach but still having the same problem. Please help me.


Top
 Profile  
 
 Post subject: Error in ORM mapping using equinox (JUnit, Hibernate, etc.
PostPosted: Tue Feb 01, 2005 10:11 pm 
Newbie

Joined: Mon Jan 17, 2005 7:32 am
Posts: 13
I just found out the solution to my problem... I just change my hibernate version to 2.0 and it works... then try to re-generate the hbm.xml files....


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.