-->
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.  [ 1 post ] 
Author Message
 Post subject: NullpointerException beim aufrufen der named Query
PostPosted: Fri Jan 27, 2006 10:42 am 
Newbie

Joined: Fri Jan 27, 2006 10:32 am
Posts: 1
Hallo Forum,

ich habe ein Problem beim aufrufen einer Named Query, und ich weiss nicht woran das liegt.

Hier der Stack:
[code]15:25:54,203 DEBUG SessionImpl:1405 - SQL query: select 1 AS route_map_id
,'ORG' AS org
,'DST' AS dst
,'airline' AS airiline
,'forwarder' AS forwarder
,10 AS pcs
,20 AS wgt
,30 AS disc_count
,40 AS excp_count
,'STATUS' AS status
from dual routeMapSearchResult
15:25:54,213 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
15:25:54,213 DEBUG ConnectionManager:296 - opening JDBC connection
15:25:54,213 DEBUG SQL:324 - select 1 AS route_map_id
,'ORG' AS org
,'DST' AS dst
,'airline' AS airiline
,'forwarder' AS forwarder
,10 AS pcs
,20 AS wgt
,30 AS disc_count
,40 AS excp_count
,'STATUS' AS status
from dual routeMapSearchResult
Hibernate: select 1 AS route_map_id
,'ORG' AS org
,'DST' AS dst
,'airline' AS airiline
,'forwarder' AS forwarder
,10 AS pcs
,20 AS wgt
,30 AS disc_count
,40 AS excp_count
,'STATUS' AS status
from dual routeMapSearchResult
15:25:54,213 DEBUG AbstractBatcher:378 - preparing statement
15:25:54,373 DEBUG AbstractBatcher:306 - about to open ResultSet (open ResultSets: 0, globally: 0)
15:25:54,373 DEBUG Loader:405 - processing result set
15:25:54,373 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
15:25:54,373 DEBUG AbstractBatcher:416 - closing statement
15:25:54,373 DEBUG JDBCContext:322 - after autocommit
java.lang.NullPointerException
at org.hibernate.loader.Loader.doQuery(Loader.java:408)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:112)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1414)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:153)
at Test.main(Test.java:32)[/code]

Und hier die Query und das Mapping dazu. Das SQL hab ich mal mit Dummy-Werten gefüllt.

[code]<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="db.hibernate.consignment">

<class name="db.hibernate.consignment.RouteMapSearchResult">
<id name="routeMapId" type="long" column="route_map_id" unsaved-value="null">
<generator class="assigned"></generator>
</id>
<property name="org" type="string" column="org" />
<property name="dst" type="string" column="dst" />
<property name="airline" type="string" column="airline" />
<property name="forwarder" type="string" column="forwarder" />
<property name="pcs" type="string" column="pcs" />
<property name="weight" type="string" column="wgt" />
<property name="discCount" type="int" column="disc_count" />
<property name="excpCount" type="int" column="excp_Count" />
<property name="status" type="string" column="status" />
<!-- <loader query-ref="routeMapSearchResultQuery"/>-->
</class>
<sql-query name="routeMapSearchResultQuery" callable="true">
<return alias="routeMapSearchResult" class="db.hibernate.consignment.RouteMapSearchResult">
<return-property name="routeMapId" column="route_map_id" />
<return-property name="org" column="org" />
<return-property name="dst" column="dst" />
<return-property name="airline" column="airline" />
<return-property name="forwarder" column="forwarder" />
<return-property name="pcs" column="pcs" />
<return-property name="weight" column="wgt" />
<return-property name="discCount" column="disc_count" />
<return-property name="excpCount" column="excp_count" />
<return-property name="status" column="status" />
</return>
select 1 AS route_map_id
,'ORG' AS org
,'DST' AS dst
,'airline' AS airiline
,'forwarder' AS forwarder
,10 AS pcs
,20 AS wgt
,30 AS disc_count
,40 AS excp_count
,'STATUS' AS status
from dual
</sql-query>
</hibernate-mapping>[/code]

Mein Aufruf erfolgt mittels:

[code] Session hbm_session = HibernateSessionFactory.currentSession();
List result=hbm_session.getNamedQuery("routeMapSearchResultQuery").list();
[/code]

Erkennt jemand den Fehler den ich gemacht habe, oder warum die NullPointerException geworfen wird?

Gruß,
Dirk[/quote]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.