-->
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: SQLQuery back mapping to class
PostPosted: Thu Jan 08, 2009 1:32 pm 
Newbie

Joined: Thu Jan 08, 2009 1:16 pm
Posts: 1
Hello ,
I have query which is join between some tables. When I am running it as a regular SQL query I am getting my Object[] without problems, but when ever I am trying to addEntity to return Object I am getting NullPointerException during query.list();

Mappings

<typedef name="play_type" class="orm.hibernate.GenericEnumUserType">
<param name="enumClass">myprojects.domain.PlayType</param>
<param name="identifierMethod">getId</param>
<param name="valueOfMethod">fromId</param>
</typedef>

<subclass name="PlayGround"
extends="MasterGround"
discriminator-value="1">

<join table="PLAY">
<key column="PLAY_ID" unique="true" />

<property name="title"
column="PLAY_TITLE"
/>

<property name="text"
column="PLAY_TEXT"
/>

<property name="pros"
column="PLAY_TEXT"
/>

<property name="cons"
column="PLAY_CONS_TEXT"
/>

<property name="rating"
column="PLAY_RATING"
/>

<property name="playType"
column="PLAY_TYPE_ID"
not-null="true"
type="play_type"
/>
</join>
</subclass>

==========

Query is

SELECT
{play.*}, {rt.*},
FROM play play
JOIN PLAY_TYPE pt
ON play.PLAY_TYPE_ID=pt.PLAY_TYPE_ID
...
WHERE play.play_id= :playid

before calling list() on query I am doing

query.addEntity("play", PlayGround.class).addJoin("pt", "play.playType");


after execution I am getting NullPointerException with out any details


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.