]
Frederico commented on HHH-2641:
--------------------------------
Hi,
if your primary key is varchar, try to change to char. This works to me.
Fred
Collection Loading
------------------
Key: HHH-2641
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2641
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.0 final
Environment: Hibernate3, Postgresql 8.1
Reporter: Frederico
Attachments: src.tar.gz
I'm not sure if this is a bug, but no one answered me in the hibernate forum, so....
I have a collection that it is not loaded, in log it seems to be ok, but when i access
the collection there is no element.
<class
name="entidades.bdufop.Sistema"
table="sistema"
schema="public"
>
<id
name="codigo"
column="codigo"
type="java.lang.String"
>
<generator class="assigned">
</generator>
</id>
<property
name="descricao"
type="java.lang.String"
update="true"
insert="true"
column="descricao"
not-null="true"
/>
<property
name="disponivel"
type="java.lang.String"
update="true"
insert="true"
column="disponivel"
not-null="true"
/>
<property
name="mensagem"
type="java.lang.String"
update="true"
insert="true"
column="mensagem"
/>
<set name="aplicacoes" lazy="true"
cascade="all">
<key column="cod_sistema"/>
<one-to-many class="entidades.bdufop.Aplicacao"/>
</set>
</class>
<class
name="entidades.bdufop.Aplicacao"
table="aplicacao"
schema="public"
>
<composite-id
name="id"
class="entidades.bdufop.Aplicacao_pk"
>
<key-property
name="codigo_sistema"
type="java.lang.String"
column="cod_sistema"
/>
<key-property
name="codigo_aplicacao"
type="java.lang.String"
column="codigo"
/>
</composite-id>
<many-to-one name="sistema"
class="entidades.bdufop.Sistema"
column="cod_sistema"
insert="false"
update="false"
unique="true"
not-null="true"/>
<property
name="descricao"
type="java.lang.String"
column="descricao"
not-null="true"
/>
<property
name="versao"
type="java.lang.String"
column="versao"
/>
<property
name="dt_versao"
type="java.util.Date"
column="dt_versao"
/>
<property
name="disponivel"
type="java.lang.String"
column="disponivel"
not-null="true"
/>
<property
name="url"
type="java.lang.String"
column="url"
/>
<property
name="mensagem"
type="java.lang.String"
column="mensagem"
/>
</class>
Log
12:21:42,060 DEBUG DefaultInitializeCollectionEventListener:41 - initializing collection
[entidades.bdufop.Sistema.aplicacoes#ACESSO]
12:21:42,063 DEBUG DefaultInitializeCollectionEventListener:47 - checking second-level
cache
12:21:42,067 DEBUG DefaultInitializeCollectionEventListener:59 - collection not cached
12:21:42,071 DEBUG Loader:1911 - loading collection:
[entidades.bdufop.Sistema.aplicacoes#ACESSO]
12:21:42,075 DEBUG AbstractBatcher:311 - about to open PreparedStatement (open
PreparedStatements: 0, globally: 0)
12:21:42,079 DEBUG ConnectionManager:415 - opening JDBC connection
12:21:42,118 DEBUG SQL:346 - select aplicacoes0_.cod_sistema as cod1_1_,
aplicacoes0_.codigo as codigo1_, aplicacoes0_.cod_sistema as cod1_1_0_,
aplicacoes0_.codigo as codigo1_0_, aplicacoes0_.descricao as descricao1_0_,
aplicacoes0_.versao as versao1_0_, aplicacoes0_.dt_versao as dt5_1_0_,
aplicacoes0_.disponivel as disponivel1_0_, aplicacoes0_.url as url1_0_,
aplicacoes0_.mensagem as mensagem1_0_ from public.aplicacao aplicacoes0_ where
aplicacoes0_.cod_sistema=?
Hibernate: select aplicacoes0_.cod_sistema as cod1_1_, aplicacoes0_.codigo as codigo1_,
aplicacoes0_.cod_sistema as cod1_1_0_, aplicacoes0_.codigo as codigo1_0_,
aplicacoes0_.descricao as descricao1_0_, aplicacoes0_.versao as versao1_0_,
aplicacoes0_.dt_versao as dt5_1_0_, aplicacoes0_.disponivel as disponivel1_0_,
aplicacoes0_.url as url1_0_, aplicacoes0_.mensagem as mensagem1_0_ from public.aplicacao
aplicacoes0_ where aplicacoes0_.cod_sistema=?
12:21:42,122 DEBUG AbstractBatcher:424 - preparing statement
12:21:42,129 DEBUG StringType:80 - binding 'ACESSO' to parameter: 1
12:21:42,144 DEBUG AbstractBatcher:327 - about to open ResultSet (open ResultSets: 0,
globally: 0)
12:21:42,148 DEBUG Loader:1040 - result set contains (possibly empty) collection:
[entidades.bdufop.Sistema.aplicacoes#ACESSO]
12:21:42,152 DEBUG CollectionLoadContext:84 - uninitialized collection: initializing
12:21:42,509 DEBUG Loader:682 - processing result set
12:21:42,513 DEBUG Loader:687 - result set row: 0
12:21:42,517 DEBUG StringType:122 - returning 'ACESSO ' as column: cod1_1_0_
12:21:42,542 DEBUG StringType:122 - returning 'AP.ACESSO ' as column: codigo1_0_
12:21:42,550 DEBUG Loader:1164 - result row:
EntityKey[entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO
, codigo_sistema=ACESSO }]
12:21:42,558 DEBUG Loader:1347 - Initializing object from ResultSet:
[entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO
, codigo_sistema=ACESSO }]
12:21:42,563 DEBUG AbstractEntityPersister:1860 - Hydrating entity:
[entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO
, codigo_sistema=ACESSO }]
12:21:42,574 DEBUG StringType:122 - returning 'ACESSO ' as column: cod1_1_0_
12:21:42,579 DEBUG StringType:122 - returning 'DESCRICAO APLICACAO ACESSO ' as
column: descricao1_0_
12:21:42,586 DEBUG StringType:122 - returning ' ' as column: versao1_0_
12:21:42,592 DEBUG TimestampType:122 - returning '2008-01-01 00:00:00' as column:
dt5_1_0_
12:21:42,598 DEBUG StringType:122 - returning 'S' as column: disponivel1_0_
12:21:42,602 DEBUG StringType:122 - returning '' as column: url1_0_
12:21:42,608 DEBUG StringType:122 - returning '' as column: mensagem1_0_
12:21:42,613 DEBUG StringType:122 - returning 'ACESSO ' as column: cod1_1_
12:21:42,618 DEBUG Loader:972 - found row of collection:
[entidades.bdufop.Sistema.aplicacoes#ACESSO ]
12:21:42,640 DEBUG CollectionLoadContext:100 - new collection: instantiating
12:21:42,659 DEBUG StringType:122 - returning 'ACESSO ' as column: cod1_1_
12:21:42,665 DEBUG StringType:122 - returning 'AP.ACESSO ' as column: codigo1_
12:21:42,671 DEBUG DefaultLoadEventListener:153 - loading entity:
[entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO
, codigo_sistema=ACESSO }]
12:21:42,677 DEBUG DefaultLoadEventListener:304 - attempting to resolve:
[entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO
, codigo_sistema=ACESSO }]
12:21:42,687 DEBUG DefaultLoadEventListener:313 - resolved object in session cache:
[entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO
, codigo_sistema=ACESSO }]
12:21:42,712 DEBUG Loader:709 - done processing result set (1 rows)
12:21:42,716 DEBUG AbstractBatcher:334 - about to close ResultSet (open ResultSets: 1,
globally: 1)
12:21:42,721 DEBUG AbstractBatcher:319 - about to close PreparedStatement (open
PreparedStatements: 1, globally: 1)
12:21:42,757 DEBUG AbstractBatcher:470 - closing statement
12:21:42,806 DEBUG ConnectionManager:398 - aggressively releasing JDBC connection
12:21:42,815 DEBUG ConnectionManager:435 - releasing JDBC connection [ (open
PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
12:21:42,821 DEBUG Loader:839 - total objects hydrated: 1
12:21:42,829 DEBUG TwoPhaseLoad:107 - resolving associations for
[entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO
, codigo_sistema=ACESSO }]
12:21:42,834 DEBUG DefaultLoadEventListener:153 - loading entity:
[entidades.bdufop.Sistema#ACESSO ]
12:21:42,874 DEBUG DefaultLoadEventListener:230 - creating new proxy for entity
12:21:43,422 DEBUG TwoPhaseLoad:206 - done materializing entity
[entidades.bdufop.Aplicacao#component[codigo_sistema,codigo_aplicacao]{codigo_aplicacao=AP.ACESSO
, codigo_sistema=ACESSO }]
12:21:43,427 DEBUG CollectionLoadContext:262 - 2 collections were found in result set for
role: entidades.bdufop.Sistema.aplicacoes
12:21:43,432 DEBUG CollectionLoadContext:206 - collection fully initialized:
[entidades.bdufop.Sistema.aplicacoes#ACESSO]
12:21:43,436 DEBUG CollectionLoadContext:206 - collection fully initialized:
[entidades.bdufop.Sistema.aplicacoes#ACESSO ]
12:21:43,441 DEBUG CollectionLoadContext:272 - 2 collections initialized for role:
entidades.bdufop.Sistema.aplicacoes
12:21:43,445 DEBUG StatefulPersistenceContext:748 - initializing non-lazy collections
12:21:43,449 DEBUG Loader:1935 - done loading collection
12:21:43,453 DEBUG DefaultInitializeCollectionEventListener:61 - collection initialized
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: