-->
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: Problème pour avoir les datas d'une vue (rowcount:ok)
PostPosted: Mon May 14, 2007 10:05 am 
Newbie

Joined: Mon May 14, 2007 9:49 am
Posts: 2
Bonjour,

Je suis nouveau dans Hibernate et j'ai un léger problème que je ne comprend pas.
J'ai fait un "reverse engineering d'une DB Oracle et, pas de problème, une query marche en ce qui concerne des tables.
Par contre, pour une vue, j'ai bien le bon nombre d'objets dans ma liste, mais tous ces objets sont nulls !

=> Dans le code ci-dessous, "lSitesActeursRoles.size()" me rend bien mon nombre de records de ma vue... mais "lSitesActeursRoles.get(0)" vaut null, pour chacun des objets...

Une idée ?

Merci,
Julien.


Hibernate version:
core=3.2.3
tools=3.2beta9

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 26-avr.-2007 18:07:16 by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping>
<class name="be.wallonie.mobilite.carto.hibernate.VSiteActeurRole" table="V_SITE_ACTEUR_ROLE" schema="DG3">
<composite-id name="id" class="be.wallonie.mobilite.carto.hibernate.VSiteActeurRoleId">
<key-property name="CActeur" type="big_decimal">
<column name="C_ACTEUR" precision="22" scale="0" />
</key-property>
<key-property name="roleActeur" type="string">
<column name="ROLE_ACTEUR" length="30" />
</key-property>
...
</composite-id>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Query q = HibernateUtil.currentSession().createQuery("from VSiteActeurRole");
List lSitesActeursRoles = q.list();

Full stack trace of any exception that occurs:
Aucun

Name and version of the database you are using:
Oracle 8i

The generated SQL (show_sql=true):
2007-05-14 15:36:21,746 [main] DEBUG (AbstractBatcher.java:401) - select vsiteacteu0_.C_ACTEUR as C1_77_, vsiteacteu0_.ROLE_ACTEUR as ROLE2_77_, ... from DG3.V_SITE_ACTEUR_ROLE vsiteacteu0_


Debug level Hibernate log excerpt:
2007-05-14 15:36:21,746 [main] DEBUG (AbstractBatcher.java:484) - preparing statement
2007-05-14 15:36:23,606 [main] DEBUG (AbstractBatcher.java:382) - about to open ResultSet (open ResultSets: 0, globally: 0)
2007-05-14 15:36:26,357 [main] DEBUG (Loader.java:694) - processing result set
2007-05-14 15:36:26,373 [main] DEBUG (Loader.java:699) - result set row: 0
2007-05-14 15:36:27,795 [main] DEBUG (Loader.java:1173) - result row: null
2007-05-14 15:36:27,795 [main] DEBUG (Loader.java:699) - result set row: 1
2007-05-14 15:36:28,920 [main] DEBUG (Loader.java:1173) - result row: null


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2007 4:47 am 
Newbie

Joined: Mon May 14, 2007 9:49 am
Posts: 2
Ok, j'ai trouvé sur le forum en anglais.

En fait, j'ai des colonnes qui sont susceptibles d'être null dans ma vue.
Or on ne peut absolument pas avoir de colonne avec des valeurs nulles dans une "composite-id".
C'est visiblement cela qui fait que "null" est renvoyé pour le record entier.

Liens vers les posts du forum anglais :
- http://forum.hibernate.org/viewtopic.ph ... +null+rows
- http://forum.hibernate.org/viewtopic.ph ... +null+rows

Julien.


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.