Hibernate version: 2.0.3
Mapping documents:
hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration.dtd">
<hibernate-configuration>
<!-- shared properties -->
<property name="show_sql">true</property>
<property name="use_outer_join">false</property>
<property name="use_streams_for_binary">true</property>
<property name="connection.pool_size">4</property>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory name="xxx">
<!-- properties for this SessionFactory only -->
<property name="dialect">cirrus.hibernate.sql.PostgreSQLDialect</property>
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="connection.username">postgres</property>
<property name="connection.password">qwerty</property>
<!--<property name="connection.url">jdbc:postgresql:portal</property>-->
<property name="connection.url">jdbc:postgresql://192.168.2.81:5432/portal</property>
<!-- Mapping Portal -->
<!-- XML de usuarios -->
<mapping resource="es/dvc/cotursa/domain/usuario/UsuarioCotursa.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/usuario/Rol.hbm.xml"/>
<!-- XML de servicios -->
<mapping resource="es/dvc/cotursa/domain/servicio/TarifaServicio.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/servicio/TipoTarifaServicio.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/servicio/TipoTarifaServicioList.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/servicio/Servicio.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/servicio/ServicioInfo.hbm.xml"/>
<!-- XML de ofertas -->
<mapping resource="es/dvc/cotursa/domain/oferta/Oferta.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/oferta/OfertaInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/oferta/TipoOferta.hbm.xml"/>
<!-- XML de reservas -->
<mapping resource="es/dvc/cotursa/domain/reserva/Cliente.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/reserva/ItemReserva.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/reserva/Moneda.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/reserva/Reserva.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/reserva/Tarifa.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/reserva/ReduccionRegimen.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/reserva/ReduccionTipoHabitacion.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/reserva/ConversorMoneda.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/reserva/Comision.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/reserva/FormaPago.hbm.xml"/>
<!-- XML de cadena -->
<mapping resource="es/dvc/cotursa/domain/cadena/CadenaHotelera.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/cadena/CadenaHoteleraInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/cadena/Elemento.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/cadena/ElementoInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/cadena/OfertaEmpleo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/cadena/OfertaEmpleoInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/cadena/Parametros.hbm.xml"/>
<!-- XML de hotel -->
<mapping resource="es/dvc/cotursa/domain/hotel/Aeropuerto.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/CaracteristicasHab.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/CaracteristicasHotel.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/Ciudad.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/CiudadInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/DistanciaAeropuertoHotel.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/DistanciaAeropuertoZona.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/EntidadHotelera.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/Etiquetas.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/Foto.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/FotoInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/HotelInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/Idioma.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/Mapa.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/Ocupacion.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/Pais.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/PaisInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/Plano.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/Regimen.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/CodigoRegimen.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/RegimenInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/ResortInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/TipoHabitacion.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/TipoHabitacionInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/CodigoTipoHabitacion.hbm.xml"/>
<!--mapping resource="es/dvc/cotursa/domain/hotel/tipoInformacion.hbm.xml"/-->
<mapping resource="es/dvc/cotursa/domain/hotel/Video.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/VideoInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/Zona.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/ZonaInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/PdfVisitaVirtual.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/PdfVv.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/PdfVvInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/Categoria.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/CategoriaInfo.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/EntidadHoteleraCategoria.hbm.xml"/>
<mapping resource="es/dvc/cotursa/domain/hotel/EntidadHoteleraCategoriaInfo.hbm.xml"/>
<!-- XML de Auditor -->
<mapping resource="es/dvc/cotursa/cma/auditor/CMSEntityHistory.hbm.xml"/>
</session-factory>
</hibernate-configuration>
cliente.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping.dtd">
<hibernate-mapping>
<class name="es.dvc.cotursa.domain.reserva.Cliente" table="cliente" discriminator-value="Cliente">
<id name="oid" column="id" unsaved-value="null"><generator class="sequence"/></id>
<discriminator column="class"/>
<property name="direccion"/>
<property name="ciudad"/>
<property name="provincia"/>
<property name="codigoPostal"/>
<property name="pais"/>
<property name="telefono"/>
<property name="email"/>
<property name="usuario"/>
<property name="password"/>
<set role="reservas" table="reserva" lazy="true">
<key column="cliente"/>
<one-to-many class="es.dvc.cotursa.domain.reserva.Reserva"/>
</set>
<many-to-one name="idioma" class="es.dvc.cotursa.domain.hotel.Idioma"/>
<subclass name="es.dvc.cotursa.domain.reserva.AgenciaViajes" discriminator-value="AgenciaViajes">
<property name="idAgenciaViajes"/>
<property name="nombreAgenciaViajes"/>
<property name="CIFAgenciaViajes"/>
<property name="FAXAgenciaViajes"/>
<property name="validarAgenciaViajes"/>
<property name="CCAgenciaViajes"/>
<property name="nombrePersonaContactoAgencia"/>
<property name="apellidosPersonaContactoAgencia"/>
<property name="deptPersonaContactoAgencia"/>
<property name="cargoPersonaContactoAgencia"/>
<property name="tratoPersonaContactoAgencia"/>
<set role="comisiones" table="comision" cascade="all" lazy="true">
<key column="agenciaViajes"/>
<one-to-many class="es.dvc.cotursa.domain.reserva.Comision"/>
</set>
</subclass>
</class>
</hibernate-mapping>
comision.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping.dtd">
<hibernate-mapping>
<class name="es.dvc.cotursa.domain.reserva.Comision" table="comision">
<id name="oid" column="id" unsaved-value="null"><generator class="sequence"/></id>
<property name="porcentaje"/>
<many-to-one name="entidadHotelera" class="es.dvc.cotursa.domain.hotel.EntidadHotelera"/>
<many-to-one name="agenciaViajes" class="es.dvc.cotursa.domain.reserva.AgenciaViajes"/>
</class>
</hibernate-mapping>
entidadHotelera.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping.dtd">
<hibernate-mapping>
<class name="es.dvc.cotursa.domain.hotel.EntidadHotelera" table="entidadHotelera" discriminator-value="E">
<id name="oid" column="id" unsaved-value="null"><generator class="sequence"/></id>
<discriminator column="class"/>
<property name="codigo"/>
<property name="nombre"/>
<property name="edadBebe"/>
<property name="edadNinyo"/>
<property name="edadAdulto"/>
<set role="servicios" table="servicio" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.servicio.Servicio"/>
</set>
<many-to-one name="ciudad" class="es.dvc.cotursa.domain.hotel.Ciudad"/>
<many-to-one name="habitacionBase" class="es.dvc.cotursa.domain.hotel.TipoHabitacion"/>
<many-to-one name="regimenBase" class="es.dvc.cotursa.domain.hotel.Regimen"/>
<set role="fotos" table="foto" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.hotel.Foto"/>
</set>
<set role="videos" table="video" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.hotel.Video"/>
</set>
<set role="regimenes" table="regimen" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.hotel.Regimen"/>
</set>
<set role="ofertas" table="oferta" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.oferta.Oferta"/>
</set>
<set role="tiposHabitaciones" table="tipoHabitacion" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.hotel.TipoHabitacion"/>
</set>
<set role="tarifas" table="tarifa" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.reserva.Tarifa"/>
</set>
<many-to-one name="moneda" class="es.dvc.cotursa.domain.reserva.Moneda"/>
<set role="itemsReservas" table="itemReserva" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.reserva.ItemReserva"/>
</set>
<set role="distanciasAeropuertosHotel" table="distanciaAeropuertoHotel" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.hotel.DistanciaAeropuertoHotel"/>
</set>
<set role="comisiones" table="comision" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.reserva.Comision"/>
</set>
<set role="entidadHoteleraCategorias" table="entidadHoteleraCategoria" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.hotel.EntidadHoteleraCategoria"/>
</set>
<set role="ocupaciones" table="Ocupacion" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.hotel.Ocupacion"/>
</set>
<set role="usuariosCotursa" table="usuarioCotursa_entidadHotelera" lazy="true">
<key column="entidadHotelera"/>
<many-to-many column="usuarioCotursa" class="es.dvc.cotursa.domain.usuario.UsuarioCotursa"/>
</set>
<set role="empresas" table="entidadHotelera_empresa" lazy="true">
<key column="entidadHotelera"/>
<many-to-many column="empresa" class="es.dvc.cotursa.domain.reserva.Empresa"/>
</set>
<subclass name="es.dvc.cotursa.domain.hotel.Hotel" discriminator-value="H">
<property name="numHabsTotales"/>
<property name="publicado"/>
<property name="direccion"/>
<property name="telefono"/>
<many-to-one name="resort" class="es.dvc.cotursa.domain.hotel.Resort"/>
<set role="hotelesInfo" table="hotelInfo" cascade="all">
<key column="hotel"/>
<one-to-many class="es.dvc.cotursa.domain.hotel.HotelInfo"/>
</set>
<set role="caracteristicasHoteles" table="hotel_caracteristicasHotel" lazy="true">
<key column="hotel"/>
<many-to-many column="caracteristicasHotel" class="es.dvc.cotursa.domain.hotel.CaracteristicasHotel"/>
</set>
<set role="pdfsVisitasVirtuales" table="pdfVisitaVirtual" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.hotel.PdfVisitaVirtual"/>
</set>
<set role="pdfVvs" table="pdfvv" cascade="all" lazy="true">
<key column="entidadHotelera"/>
<one-to-many class="es.dvc.cotursa.domain.hotel.PdfVv"/>
</set>
</subclass>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
try{
sesionPro = SessionProvider.getInstance().getSession();
String usuario = (String) dynaForm.get("usuario");
String password = (String) dynaForm.get("password");
boolean ok = true;
//Generamos la query para hacer la consulta
String query = " select cliente from cliente in class es.dvc.cotursa.domain.reserva.Cliente " +
" where cliente.usuario = ?" +
" and cliente.password = ?";
ArrayList cliente = (ArrayList)sesionPro.find(query,
new Object[] {usuario, password},
new Type[] {Hibernate.STRING, Hibernate.STRING});
sesionPro.connection().commit();
if(cliente.size()>0) {
Cliente clienteIdentificado = (Cliente)cliente.get(0);
if(clienteIdentificado instanceof AgenciaViajes) {
AgenciaViajes agv = (AgenciaViajes)clienteIdentificado;
}
}
}catch (HibernateException ex) {
sesionPro.connection().rollback();
out = "fail";
}catch (SQLException ex) {
sesionPro.connection().rollback();
out = "fail";
}catch (Exception ex) {
sesionPro.connection().rollback();
out = "fail";
}finally{
try{
sesionPro.close();
}catch (HibernateException ex) {
out = "fail";
}catch (SQLException ex) {
out = "fail";
}
}
Full stack trace of any exception that occurs:
Name and version of the database you are using:
Postgresql 7.3
The generated SQL (show_sql=true):
Hibernate: SELECT cliente.id as id, cliente.class as class, cliente.direccion as direccion, cliente.ciudad as ciudad, cliente
.provincia as provincia, cliente.codigoPostal as codigoPostal, cliente.pais as pais, cliente.telefono as telefono, cliente.em
ail as email, cliente.usuario as usuario, cliente.password as password, cliente.idioma as idioma, cliente.idAgenciaViajes as
idAgenciaViajes, cliente.nombreAgenciaViajes as nombreAgenciaViajes, cliente.CIFAgenciaViajes as CIFAgenciaViajes, cliente.FA
XAgenciaViajes as FAXAgenciaViajes, cliente.validarAgenciaViajes as validarAgenciaViajes, cliente.CCAgenciaViajes as CCAgenci
aViajes, cliente.nombrePersonaContactoAgencia as nombrePersonaContactoAgencia, cliente.apellidosPersonaContactoAgencia as ape
llidosPersonaContactoAgencia, cliente.deptPersonaContactoAgencia as deptPersonaContactoAgencia, cliente.cargoPersonaContactoA
gencia as cargoPersonaContactoAgencia, cliente.tratoPersonaContactoAgencia as tratoPersonaContactoAgencia, cliente.idEmpresa
as idEmpresa, cliente.nombreEmpresa as nombreEmpresa, cliente.CIFEmpresa as CIFEmpresa, cliente.FAXEmpresa as FAXEmpresa, cli
ente.validarEmpresa as validarEmpresa, cliente.nombrePersonaContactoEmpresa as nombrePersonaContactoEmpresa, cliente.apellido
sPersonaContactoEmpresa as apellidosPersonaContactoEmpresa, cliente.deptPersonaContactoEmpresa as deptPersonaContactoEmpresa,
cliente.cargoPersonaContactoEmpresa as cargoPersonaContactoEmpresa, cliente.tratoPersonaContactoEmpresa as tratoPersonaConta
ctoEmpresa, cliente.nombre as nombre, cliente.apellidos as apellidos, cliente.NIF as NIF FROM cliente cliente WHERE (cliente.
usuario=? )and(cliente.password=? )
Hibernate: SELECT Idiom0.id AS id, Idiom0.nombre as nombre, Idiom0.bandera as bandera FROM idioma Idiom0 WHERE Idiom0.id = ?
Hibernate: SELECT hotel0.id, hotel0.id AS id, hotel0.textoBienvenida as textoBienvenida, hotel0.categoriaOficial as categoria
Oficial, hotel0.clasificacion as clasificacion, hotel0.descRestaurantes as descRestaurantes, hotel0.descBares as descBares, h
otel0.ubicacion as ubicacion, hotel0.instalaciones as instalaciones, hotel0.traducido as traducido, hotel0.descSalaReuniones
as descSalaReuniones, hotel0.descWellnessGim as descWellnessGim, hotel0.hotel as hotel, hotel0.idioma as idioma FROM hotelInf
o hotel0 WHERE hotel0.idioma = ?
Hibernate: SELECT Hotel0.id AS id, Hotel0.numHabsTotales as numHabsTotales, Hotel0.publicado as publicado, Hotel0.direccion a
s direccion, Hotel0.telefono as telefono, Hotel0.resort as resort, Hotel0.codigo as codigo, Hotel0.nombre as nombre, Hotel0.e
dadBebe as edadBebe, Hotel0.edadNinyo as edadNinyo, Hotel0.edadAdulto as edadAdulto, Hotel0.ciudad as ciudad, Hotel0.habitaci
onBase as habitacionBase, Hotel0.regimenBase as regimenBase, Hotel0.moneda as moneda FROM entidadHotelera Hotel0 WHERE Hotel0
.id = ?
Hibernate: SELECT hotel0.id, hotel0.id AS id, hotel0.textoBienvenida as textoBienvenida, hotel0.categoriaOficial as categoria
Oficial, hotel0.clasificacion as clasificacion, hotel0.descRestaurantes as descRestaurantes, hotel0.descBares as descBares, h
otel0.ubicacion as ubicacion, hotel0.instalaciones as instalaciones, hotel0.traducido as traducido, hotel0.descSalaReuniones
as descSalaReuniones, hotel0.descWellnessGim as descWellnessGim, hotel0.hotel as hotel, hotel0.idioma as idioma FROM hotelInf
o hotel0 WHERE hotel0.hotel = ?
Hibernate: SELECT Idiom0.id AS id, Idiom0.nombre as nombre, Idiom0.bandera as bandera FROM idioma Idiom0 WHERE Idiom0.id = ?
Hibernate: SELECT hotel0.id, hotel0.id AS id, hotel0.textoBienvenida as textoBienvenida, hotel0.categoriaOficial as categoria
Oficial, hotel0.clasificacion as clasificacion, hotel0.descRestaurantes as descRestaurantes, hotel0.descBares as descBares, h
otel0.ubicacion as ubicacion, hotel0.instalaciones as instalaciones, hotel0.traducido as traducido, hotel0.descSalaReuniones
as descSalaReuniones, hotel0.descWellnessGim as descWellnessGim, hotel0.hotel as hotel, hotel0.idioma as idioma FROM hotelInf
o hotel0 WHERE hotel0.idioma = ?
...
...
Hibernate: SELECT fotoI0.id, fotoI0.id AS id, fotoI0.descripcion as descripcion, fotoI0.traducido as traducido, fotoI0.foto a
s foto, fotoI0.idioma as idioma FROM fotoInfo fotoI0 WHERE fotoI0.foto = ?
Hibernate: SELECT Foto0.id AS id, Foto0.nombre as nombre, Foto0.nombreAmpliada as nombreAmpliada, Foto0.tipo as tipo, Foto0.p
ais as pais, Foto0.zona as zona, Foto0.servicio as servicio, Foto0.tipoHabitacion as tipoHabitacion, Foto0.ciudad as ciudad,
Foto0.entidadHotelera as entidadHotelera FROM foto Foto0 WHERE Foto0.id = ?
Hibernate: SELECT fotoI0.id, fotoI0.id AS id, fotoI0.descripcion as descripcion, fotoI0.traducido as traducido, fotoI0.foto a
s foto, fotoI0.idioma as idioma FROM fotoInfo fotoI0 WHERE fotoI0.foto = ?
Hibernate: SELECT Foto0.id AS id, Foto0.nombre as nombre, Foto0.nombreAmpliada as nombreAmpliada, Foto0.tipo as tipo, Foto0.p
ais as pais, Foto0.zona as zona, Foto0.servicio as servicio, Foto0.tipoHabitacion as tipoHabitacion, Foto0.ciudad as ciudad,
Foto0.entidadHotelera as entidadHotelera FROM foto Foto0 WHERE Foto0.id = ?
Hibernate: SELECT fotoI0.id, fotoI0.id AS id, fotoI0.descripcion as descripcion, fotoI0.traducido as traducido, fotoI0.foto a
s foto, fotoI0.idioma as idioma FROM fotoInfo fotoI0 WHERE fotoI0.foto = ?
Hibernate: SELECT Foto0.id AS id, Foto0.nombre as nombre, Foto0.nombreAmpliada as nombreAmpliada, Foto0.tipo as tipo, Foto0.p
ais as pais, Foto0.zona as zona, Foto0.servicio as servicio, Foto0.tipoHabitacion as tipoHabitacion, Foto0.ciudad as ciudad,
Foto0.entidadHotelera as entidadHotelera FROM foto Foto0 WHERE Foto0.id = ?
Hibernate: SELECT fotoI0.id, fotoI0.id AS id, fotoI0.descripcion as descripcion, fotoI0.traducido as traducido, fotoI0.foto a
s foto, fotoI0.idioma as idioma FROM fotoInfo fotoI0 WHERE fotoI0.foto = ?
Hibernate: SELECT Foto0.id AS id, Foto0.nombre as nombre, Foto0.nombreAmpliada as nombreAmpliada, Foto0.tipo as tipo, Foto0.p
ais as pais, Foto0.zona as zona, Foto0.servicio as servicio, Foto0.tipoHabitacion as tipoHabitacion, Foto0.ciudad as ciudad,
Foto0.entidadHotelera as entidadHotelera FROM foto Foto0 WHERE Foto0.id = ?
...
...
Hibernate: SELECT Regim0.id AS id, Regim0.publicado as publicado, Regim0.suplementoAdulto as suplementoAdulto, Regim0.supleme
ntoNinyo as suplementoNinyo, Regim0.entidadHotelera as entidadHotelera, Regim0.codigoRegimen as codigoRegimen FROM regimen Re
gim0 WHERE Regim0.id = ?
Hibernate: SELECT regim0.id, regim0.id AS id, regim0.nombre as nombre, regim0.descripcion as descripcion, regim0.traducido as
traducido, regim0.regimen as regimen, regim0.idioma as idioma FROM regimenInfo regim0 WHERE regim0.regimen = ?
Hibernate: SELECT regim0.id, regim0.id AS id, regim0.nombre as nombre, regim0.descripcion as descripcion, regim0.traducido as
traducido, regim0.regimen as regimen, regim0.idioma as idioma FROM regimenInfo regim0 WHERE regim0.idioma = ?
Hibernate: SELECT paisI0.id, paisI0.id AS id, paisI0.nombre as nombre, paisI0.textoBienvenida as textoBienvenida, paisI0.docN
ecesaria as docNecesaria, paisI0.idiomaPais as idiomaPais, paisI0.climatologia as climatologia, paisI0.vestimenta as vestimen
ta, paisI0.dutyFree as dutyFree, paisI0.electricidad as electricidad, paisI0.capital as capital, paisI0.historia as historia,
paisI0.ocioCultura as ocioCultura, paisI0.infoUtiles as infoUtiles, paisI0.traducido as traducido, paisI0.pais as pais, pais
I0.idioma as idioma FROM paisInfo paisI0 WHERE paisI0.idioma = ?
...
...
Hi,
As is it possible to see from the information given above, when we launch a cliente object query, hibernate loads its information and its associated collections even if they are declared widh "LAZY=TRUE".
As a example:
we want to load a Cliente (type AgenciaViages) and hibernate launches all the queries to load Comisiones and EntidadHotelera. Notice that in the Cliente.hbm.xml the relation with Comisiones has the attribute lazy equals true.
<set role="comisiones" table="comision" cascade="all" lazy="true">
<key column="agenciaViajes"/>
<one-to-many class="es.dvc.cotursa.domain.reserva.Comision"/>
</set>
and Comisiones.hbm.xml has a relation many-to.one with entidadHotelera
<many-to-one name="entidadHotelera" class="es.dvc.cotursa.domain.hotel.EntidadHotelera"/>
How could we avoid this performance? we only desire to load Cliente information.
Thanks in advance.
|