first of all, lot of thanks for your fast answer. and yeah, you're right: I've replaced the Collection for a Set. Anyway, the problem is the same: no Airports are loaded as destination and after the commit of the transaction all the values of the LinkedAirports table are deleted :-( That's the log, if you're so kind to make a quick reading I'll be very grateful. The code is in Spanish but I think it's quite similar to the English words (Aeropuerto->Airport, aeropuertosEnlazados -> destinations). The processing concludes generating a javascript equivalent of the java objects (something like json, but more flexible).
Anyway, lot of thanks, really.
jv
5937 DEBUG org.hibernate.loader.collection.BasicCollectionLoader - Static select for collection com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados: select aeropuerto0_.idAeropuertoOrigen as idAeropu1_1_, aeropuerto0_.idAeropuertoDestino as idAeropu2_1_, aeropuerto1_.id as id0_0_, aeropuerto1_.codigo as codigo0_0_, aeropuerto1_.nombre as nombre0_0_, aeropuerto1_.poblacion as poblacion0_0_ from aeropuertosenlazados aeropuerto0_ left outer join aeropuertos aeropuerto1_ on aeropuerto0_.idAeropuertoDestino=aeropuerto1_.id where aeropuerto0_.idAeropuertoOrigen=?
5937 DEBUG org.hibernate.impl.SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
5969 DEBUG org.hibernate.impl.SessionFactoryObjectFactory - registered: 402880b20aa9554a010aa95551390000 (unnamed)
5969 INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
5969 DEBUG org.hibernate.impl.SessionFactoryImpl - instantiated session factory
5984 DEBUG org.hibernate.impl.SessionFactoryImpl - Checking 0 named HQL queries
5984 DEBUG org.hibernate.impl.SessionFactoryImpl - Checking 0 named SQL queries
6156 DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 11453022416
6156 DEBUG org.hibernate.transaction.JDBCTransaction - begin
6156 DEBUG org.hibernate.jdbc.ConnectionManager - opening JDBC connection
6156 DEBUG org.hibernate.transaction.JDBCTransaction - current autocommit status: true
6156 DEBUG org.hibernate.transaction.JDBCTransaction - disabling autocommit
6156 DEBUG org.hibernate.jdbc.JDBCContext - after transaction begin
6156 INFO com.echiceros.framework.dao.DAOFactory - Inicializando DAOFactory (com.echiceros.framework.dao.HibernateDAOFactory).
6187 DEBUG org.hibernate.engine.query.QueryPlanCache - unable to locate HQL query plan in cache; generating (from Aeropuerto)
6453 DEBUG org.hibernate.hql.ast.QueryTranslatorImpl - parse() - HQL: from com.echiceros.bucks.modelo.Aeropuerto
6484 DEBUG org.hibernate.hql.ast.AST - --- HQL AST ---
\-[QUERY] 'query'
\-[SELECT_FROM] 'SELECT_FROM'
\-[FROM] 'from'
\-[RANGE] 'RANGE'
\-[DOT] '.'
+-[DOT] '.'
| +-[DOT] '.'
| | +-[DOT] '.'
| | | +-[IDENT] 'com'
| | | \-[IDENT] 'echiceros'
| | \-[IDENT] 'bucks'
| \-[IDENT] 'modelo'
\-[IDENT] 'Aeropuerto'
6547 DEBUG org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors
6672 DEBUG org.hibernate.hql.antlr.HqlSqlBaseWalker - select << begin [level=1, statement=select]
6828 DEBUG org.hibernate.hql.ast.tree.FromElement - FromClause{level=1} : com.echiceros.bucks.modelo.Aeropuerto (no alias) -> aeropuerto0_
6828 DEBUG org.hibernate.hql.antlr.HqlSqlBaseWalker - select : finishing up [level=1, statement=select]
6828 DEBUG org.hibernate.hql.ast.HqlSqlWalker - processQuery() : ( SELECT ( FromClause{level=1} aeropuertos aeropuerto0_ ) )
6844 DEBUG org.hibernate.hql.ast.HqlSqlWalker - Derived SELECT clause created.
6875 DEBUG org.hibernate.hql.ast.util.JoinProcessor - Using FROM fragment [aeropuertos aeropuerto0_]
6906 DEBUG org.hibernate.hql.antlr.HqlSqlBaseWalker - select >> end [level=1, statement=select]
6906 DEBUG org.hibernate.hql.ast.AST - --- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (aeropuertos)
+-[SELECT_CLAUSE] SelectClause: '{derived select clause}'
| +-[SELECT_EXPR] SelectExpressionImpl: 'aeropuerto0_.id as id0_' {FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=aeropuertos,tableAlias=aeropuerto0_,origin=null,colums={,className=com.echiceros.bucks.modelo.Aeropuerto}}}
| \-[SQL_TOKEN] SqlFragment: 'aeropuerto0_.codigo as codigo0_, aeropuerto0_.nombre as nombre0_, aeropuerto0_.poblacion as poblacion0_'
\-[FROM] FromClause: 'from' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[], fromElementByTableAlias=[aeropuerto0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
\-[FROM_FRAGMENT] FromElement: 'aeropuertos aeropuerto0_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=aeropuertos,tableAlias=aeropuerto0_,origin=null,colums={,className=com.echiceros.bucks.modelo.Aeropuerto}}
6906 DEBUG org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors
6953 DEBUG org.hibernate.hql.ast.QueryTranslatorImpl - HQL: from com.echiceros.bucks.modelo.Aeropuerto
6953 DEBUG org.hibernate.hql.ast.QueryTranslatorImpl - SQL: select aeropuerto0_.id as id0_, aeropuerto0_.codigo as codigo0_, aeropuerto0_.nombre as nombre0_, aeropuerto0_.poblacion as poblacion0_ from aeropuertos aeropuerto0_
6953 DEBUG org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors
6984 DEBUG org.hibernate.engine.query.HQLQueryPlan - HQL param location recognition took 15 mills (from Aeropuerto)
7062 DEBUG org.hibernate.engine.query.QueryPlanCache - located HQL query plan in cache (from Aeropuerto)
7062 DEBUG org.hibernate.engine.query.HQLQueryPlan - find: from Aeropuerto
7062 DEBUG org.hibernate.engine.QueryParameters - named parameters: {}
7078 DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
7078 DEBUG org.hibernate.SQL - select aeropuerto0_.id as id0_, aeropuerto0_.codigo as codigo0_, aeropuerto0_.nombre as nombre0_, aeropuerto0_.poblacion as poblacion0_ from aeropuertos aeropuerto0_ limit ?
Hibernate: select aeropuerto0_.id as id0_, aeropuerto0_.codigo as codigo0_, aeropuerto0_.nombre as nombre0_, aeropuerto0_.poblacion as poblacion0_ from aeropuertos aeropuerto0_ limit ?
7187 DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
7187 DEBUG org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
7187 DEBUG org.hibernate.loader.Loader - processing result set
7187 DEBUG org.hibernate.loader.Loader - result set row: 0
7187 DEBUG org.hibernate.type.LongType - returning '1' as column: id0_
7203 DEBUG org.hibernate.loader.Loader - result row: EntityKey[com.echiceros.bucks.modelo.Aeropuerto#1]
7203 DEBUG org.hibernate.loader.Loader - Initializing object from ResultSet: [com.echiceros.bucks.modelo.Aeropuerto#1]
7219 DEBUG org.hibernate.persister.entity.AbstractEntityPersister - Hydrating entity: [com.echiceros.bucks.modelo.Aeropuerto#1]
7219 DEBUG org.hibernate.type.StringType - returning 'AE10' as column: codigo0_
7219 DEBUG org.hibernate.type.StringType - returning 'Girona' as column: nombre0_
7219 DEBUG org.hibernate.type.StringType - returning 'GIRONA' as column: poblacion0_
7312 DEBUG org.hibernate.loader.Loader - result set row: 1
7312 DEBUG org.hibernate.type.LongType - returning '2' as column: id0_
7312 DEBUG org.hibernate.loader.Loader - result row: EntityKey[com.echiceros.bucks.modelo.Aeropuerto#2]
7312 DEBUG org.hibernate.loader.Loader - Initializing object from ResultSet: [com.echiceros.bucks.modelo.Aeropuerto#2]
7312 DEBUG org.hibernate.persister.entity.AbstractEntityPersister - Hydrating entity: [com.echiceros.bucks.modelo.Aeropuerto#2]
7312 DEBUG org.hibernate.type.StringType - returning 'AE20' as column: codigo0_
7375 DEBUG org.hibernate.type.StringType - returning 'Sabadell' as column: nombre0_
7375 DEBUG org.hibernate.type.StringType - returning 'SABADELL' as column: poblacion0_
7375 DEBUG org.hibernate.loader.Loader - result set row: 2
7375 DEBUG org.hibernate.type.LongType - returning '3' as column: id0_
7375 DEBUG org.hibernate.loader.Loader - result row: EntityKey[com.echiceros.bucks.modelo.Aeropuerto#3]
7375 DEBUG org.hibernate.loader.Loader - Initializing object from ResultSet: [com.echiceros.bucks.modelo.Aeropuerto#3]
7375 DEBUG org.hibernate.persister.entity.AbstractEntityPersister - Hydrating entity: [com.echiceros.bucks.modelo.Aeropuerto#3]
7375 DEBUG org.hibernate.type.StringType - returning 'AE30' as column: codigo0_
7375 DEBUG org.hibernate.type.StringType - returning 'Zaragoza' as column: nombre0_
7375 DEBUG org.hibernate.type.StringType - returning 'ZARAGOZA' as column: poblacion0_
7375 DEBUG org.hibernate.loader.Loader - result set row: 3
7375 DEBUG org.hibernate.type.LongType - returning '4' as column: id0_
7375 DEBUG org.hibernate.loader.Loader - result row: EntityKey[com.echiceros.bucks.modelo.Aeropuerto#4]
7375 DEBUG org.hibernate.loader.Loader - Initializing object from ResultSet: [com.echiceros.bucks.modelo.Aeropuerto#4]
7375 DEBUG org.hibernate.persister.entity.AbstractEntityPersister - Hydrating entity: [com.echiceros.bucks.modelo.Aeropuerto#4]
7375 DEBUG org.hibernate.type.StringType - returning 'AE40' as column: codigo0_
7375 DEBUG org.hibernate.type.StringType - returning 'Reus' as column: nombre0_
7375 DEBUG org.hibernate.type.StringType - returning 'REUS' as column: poblacion0_
7375 DEBUG org.hibernate.loader.Loader - done processing result set (4 rows)
7375 DEBUG org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
7375 DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
7375 DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
7375 DEBUG org.hibernate.loader.Loader - total objects hydrated: 4
7375 DEBUG org.hibernate.engine.TwoPhaseLoad - resolving associations for [com.echiceros.bucks.modelo.Aeropuerto#1]
7390 DEBUG org.hibernate.engine.CollectionLoadContext - creating collection wrapper:[com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#1]
7406 DEBUG org.hibernate.engine.TwoPhaseLoad - done materializing entity [com.echiceros.bucks.modelo.Aeropuerto#1]
7406 DEBUG org.hibernate.engine.TwoPhaseLoad - resolving associations for [com.echiceros.bucks.modelo.Aeropuerto#2]
7406 DEBUG org.hibernate.engine.CollectionLoadContext - creating collection wrapper:[com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#2]
7406 DEBUG org.hibernate.engine.TwoPhaseLoad - done materializing entity [com.echiceros.bucks.modelo.Aeropuerto#2]
7406 DEBUG org.hibernate.engine.TwoPhaseLoad - resolving associations for [com.echiceros.bucks.modelo.Aeropuerto#3]
7406 DEBUG org.hibernate.engine.CollectionLoadContext - creating collection wrapper:[com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#3]
7406 DEBUG org.hibernate.engine.TwoPhaseLoad - done materializing entity [com.echiceros.bucks.modelo.Aeropuerto#3]
7406 DEBUG org.hibernate.engine.TwoPhaseLoad - resolving associations for [com.echiceros.bucks.modelo.Aeropuerto#4]
7406 DEBUG org.hibernate.engine.CollectionLoadContext - creating collection wrapper:[com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#4]
7406 DEBUG org.hibernate.engine.TwoPhaseLoad - done materializing entity [com.echiceros.bucks.modelo.Aeropuerto#4]
7406 DEBUG org.hibernate.engine.StatefulPersistenceContext - initializing non-lazy collections
7406 DEBUG com.echiceros.bucks.modelo.dao.AeropuertoHibDAO - Recuperados 4 aeropuertos.
7453 DEBUG com.echiceros.serialization.ecmascript.SimpleSerializer - Marshalling [com.echiceros.bucks.modelo.Aeropuerto@10cbe41, com.echiceros.bucks.modelo.Aeropuerto@166fad9, com.echiceros.bucks.modelo.Aeropuerto@1deef8a, com.echiceros.bucks.modelo.Aeropuerto@1408d95].
7562 DEBUG com.echiceros.bucks.controllers.CtrlReservaVuelos - ecma serialization: [aeropuerto10cbe41 = {nombre: 'Girona', aeropuertosEnlazados: null, class: 'class com.echiceros.bucks.modelo.Aeropuerto', poblacion: 'GIRONA', codigo: 'AE10', id: 1}, aeropuerto166fad9 = {nombre: 'Sabadell', aeropuertosEnlazados: null, class: 'class com.echiceros.bucks.modelo.Aeropuerto', poblacion: 'SABADELL', codigo: 'AE20', id: 2}, aeropuerto1deef8a = {nombre: 'Zaragoza', aeropuertosEnlazados: null, class: 'class com.echiceros.bucks.modelo.Aeropuerto', poblacion: 'ZARAGOZA', codigo: 'AE30', id: 3}, aeropuerto1408d95 = {nombre: 'Reus', aeropuertosEnlazados: null, class: 'class com.echiceros.bucks.modelo.Aeropuerto', poblacion: 'REUS', codigo: 'AE40', id: 4}]
7562 INFO com.echiceros.framework.dao.DAOFactory - Inicializando DAOFactory (com.echiceros.framework.dao.HibernateDAOFactory).
7562 DEBUG org.hibernate.transaction.JDBCTransaction - commit
7562 DEBUG org.hibernate.impl.SessionImpl - automatically flushing session
7562 DEBUG org.hibernate.event.def.AbstractFlushingEventListener - flushing session
7578 DEBUG org.hibernate.event.def.AbstractFlushingEventListener - processing flush-time cascades
7578 DEBUG org.hibernate.event.def.AbstractFlushingEventListener - dirty checking collections
7578 DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushing entities and processing referenced collections
7594 DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Processing unreferenced collections
7609 DEBUG org.hibernate.engine.Collections - Collection dereferenced: [com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#1]
7609 DEBUG org.hibernate.engine.Collections - Collection dereferenced: [com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#2]
7609 DEBUG org.hibernate.engine.Collections - Collection dereferenced: [com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#3]
7609 DEBUG org.hibernate.engine.Collections - Collection dereferenced: [com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#4]
7609 DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates
7609 DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 0 insertions, 0 updates, 0 deletions to 4 objects
7609 DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 4 removals to 4 collections
7609 DEBUG org.hibernate.pretty.Printer - listing entities:
7609 DEBUG org.hibernate.pretty.Printer - com.echiceros.bucks.modelo.Aeropuerto{nombre=Reus, aeropuertosEnlazados=null, poblacion=REUS, codigo=AE40, id=4}
7609 DEBUG org.hibernate.pretty.Printer - com.echiceros.bucks.modelo.Aeropuerto{nombre=Sabadell, aeropuertosEnlazados=null, poblacion=SABADELL, codigo=AE20, id=2}
7609 DEBUG org.hibernate.pretty.Printer - com.echiceros.bucks.modelo.Aeropuerto{nombre=Zaragoza, aeropuertosEnlazados=null, poblacion=ZARAGOZA, codigo=AE30, id=3}
7609 DEBUG org.hibernate.pretty.Printer - com.echiceros.bucks.modelo.Aeropuerto{nombre=Girona, aeropuertosEnlazados=null, poblacion=GIRONA, codigo=AE10, id=1}
7609 DEBUG org.hibernate.event.def.AbstractFlushingEventListener - executing flush
7609 DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Deleting collection: [com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#1]
7609 DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
7609 DEBUG org.hibernate.SQL - delete from aeropuertosenlazados where idAeropuertoOrigen=?
Hibernate: delete from aeropuertosenlazados where idAeropuertoOrigen=?
7609 DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
7609 DEBUG org.hibernate.type.LongType - binding '1' to parameter: 1
7609 DEBUG org.hibernate.jdbc.AbstractBatcher - Adding to batch
7609 DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - done deleting collection
7609 DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Deleting collection: [com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#2]
7609 DEBUG org.hibernate.jdbc.AbstractBatcher - reusing prepared statement
7609 DEBUG org.hibernate.SQL - delete from aeropuertosenlazados where idAeropuertoOrigen=?
Hibernate: delete from aeropuertosenlazados where idAeropuertoOrigen=?
7609 DEBUG org.hibernate.type.LongType - binding '2' to parameter: 1
7609 DEBUG org.hibernate.jdbc.AbstractBatcher - Adding to batch
7609 DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - done deleting collection
7609 DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Deleting collection: [com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#3]
7625 DEBUG org.hibernate.jdbc.AbstractBatcher - reusing prepared statement
7625 DEBUG org.hibernate.SQL - delete from aeropuertosenlazados where idAeropuertoOrigen=?
Hibernate: delete from aeropuertosenlazados where idAeropuertoOrigen=?
7625 DEBUG org.hibernate.type.LongType - binding '3' to parameter: 1
7625 DEBUG org.hibernate.jdbc.AbstractBatcher - Adding to batch
7625 DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - done deleting collection
7625 DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Deleting collection: [com.echiceros.bucks.modelo.Aeropuerto.aeropuertosEnlazados#4]
7625 DEBUG org.hibernate.jdbc.AbstractBatcher - reusing prepared statement
7625 DEBUG org.hibernate.SQL - delete from aeropuertosenlazados where idAeropuertoOrigen=?
Hibernate: delete from aeropuertosenlazados where idAeropuertoOrigen=?
7625 DEBUG org.hibernate.type.LongType - binding '4' to parameter: 1
7625 DEBUG org.hibernate.jdbc.AbstractBatcher - Adding to batch
7625 DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - done deleting collection
7625 DEBUG org.hibernate.jdbc.AbstractBatcher - Executing batch size: 4
7625 DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
7625 DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
7625 DEBUG org.hibernate.event.def.AbstractFlushingEventListener - post flush
7625 DEBUG org.hibernate.jdbc.JDBCContext - before transaction completion
7625 DEBUG org.hibernate.impl.SessionImpl - before transaction completion
7625 DEBUG org.hibernate.transaction.JDBCTransaction - re-enabling autocommit
7625 DEBUG org.hibernate.transaction.JDBCTransaction - committed JDBC Connection
7625 DEBUG org.hibernate.jdbc.JDBCContext - after transaction completion
7625 DEBUG org.hibernate.jdbc.ConnectionManager - aggressively releasing JDBC connection
7625 DEBUG org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
7640 DEBUG org.hibernate.impl.SessionImpl - after transaction completion
7640 DEBUG org.hibernate.impl.SessionImpl - closing session
7640 DEBUG org.hibernate.jdbc.ConnectionManager - connection already null in cleanup : no action
|