-->
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.  [ 2 posts ] 
Author Message
 Post subject: exception setting property value with CGLIB
PostPosted: Mon Jan 12, 2004 11:34 pm 
Newbie

Joined: Mon Jan 12, 2004 11:16 pm
Posts: 4
I get this exception when query data use hibernate2.03:

java.lang.NullPointerException
at com.entertop.bean.TrafficInfoMetaClass2.setPropertyValues(<generated>)
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:162)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1961)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
at net.sf.hibernate.loader.Loader.find(Loader.java:620)
at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:928)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1343)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:76)
at com.entertop.dao.hibernate.TrafficInfoDAOHibernate.findByStartPointEndPoint(TrafficInfoDAOHibernate.java:38)
.....
rethrown as net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.entertop.bean.TrafficInfo.?
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:167)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1961)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
at net.sf.hibernate.loader.Loader.find(Loader.java:620)
at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:928)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1343)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:76)
at com.entertop.dao.hibernate.TrafficInfoDAOHibernate.findByStartPointEndPoint(TrafficInfoDAOHibernate.java:38)
Caused by: java.lang.NullPointerException
at com.entertop.bean.TrafficInfoMetaClass2.setPropertyValues(<generated>)
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:162)

TrafficInfo.hbm.xml
<hibernate-mapping>
<class
name="com.entertop.bean.TrafficInfo"
table="SC_TrafficInfo"
dynamic-update="true"
dynamic-insert="true"
>

<id
name="id"
column="id"
type="java.lang.String"
length="32"
unsaved-value="null"
>
<generator class="uuid.hex">
</generator>
</id>

<property
name="arrivalTime"
type="java.lang.String"
update="true"
insert="true"
column="arrivalTime"
/>
.....

TrafficInfoDAOHibernate.java:
Code:
    public List findByStartPointEndPoint(String StartPoint, String EndPoint, int LimitNum)
            throws HibernateException {
        List l = null;
        try {
            beginTransaction();
//            Log.printMessage("StartPoint="+StartPoint+"EndPoint="+EndPoint,sysParam.getInstance().debugFile);
            Query q = session.createQuery("from TrafficInfo t where t.startPoint like :startPoint and t.endPoint like :endPoint");
            q.setString("startPoint", "%" + StartPoint + "%");
            q.setString("endPoint", "%" + EndPoint + "%");
            l = q.list();
            endTransaction(false);
        } catch (HibernateException he) {
            endTransaction(false);
        throw he;
        }
        return l;
    }

I catch the upper exception when I first invoke the Method findByStartPointEndPoint(),so, what's the metter? thx!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2004 1:11 am 
Newbie

Joined: Mon Jan 12, 2004 11:16 pm
Posts: 4
I have found out the problem:
there are some columns which type is int , I inserted some rows but didn't fill these columns,so the exception throwed by hibernate~.....-_-o


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