Hibernate deleted a lot of rows from the many-to-many tables again, but no action told him do that.
I found a common pattern present in all times that error happened.
Just before the request the tomcat session has been terminated because of the inactive time.
Has it any relation with the error? something about the cache? I don't know. Please help me.
hibernate logs:
11:34:44,919 DEBUG SQL:230 - select this.usuario_id as usuario_id1_, this.nombre as nombre1_, this.nombre_completo as nombre_c3_1_, this.clave as clave1_, this.email as email1_, this.telefono as telefono1_, this.rol_id as rol_id1_, rol1_.rol_id as rol_id0_, rol1_.descripcion as descripc2_0_ from usuario this left outer join rol rol1_ on this.rol_id=rol1_.rol_id where 1=1
11:34:44,928 DEBUG SQL:230 - select usuario0_.usuario_id as usuario_id1_, usuario0_.nombre as nombre1_, usuario0_.nombre_completo as nombre_c3_1_, usuario0_.clave as clave1_, usuario0_.email as email1_, usuario0_.telefono as telefono1_, usuario0_.rol_id as rol_id1_, rol1_.rol_id as rol_id0_, rol1_.descripcion as descripc2_0_ from usuario usuario0_ left outer join rol rol1_ on usuario0_.rol_id=rol1_.rol_id where usuario0_.usuario_id=?
11:34:44,932 DEBUG SQL:230 - insert into evento (fecha, descripcion, tipo, hora, usuario_id, evento_id) values (?, ?, ?, ?, ?, ?)
11:34:45,094 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,097 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,099 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,101 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,103 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,105 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,106 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,108 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,110 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,123 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,126 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,129 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,131 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,133 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,139 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,141 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,143 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,151 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,154 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,157 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,160 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,163 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,167 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,170 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,173 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,176 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,179 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,182 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,185 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,188 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,193 DEBUG SQL:230 - delete from pyme_cantidad_emp where empresa_id=?
11:34:45,198 DEBUG SQL:230 - delete from pyme_plan where empresa_id=?
11:34:45,251 DEBUG SQL:230 - delete from pyme_mercado_local where empresa_id=?
11:34:45,255 DEBUG SQL:230 - delete from pyme_plan where plan_id=?
11:34:45,260 DEBUG SQL:230 - delete from pyme_cantidad_emp where empresa_id=?
11:34:45,263 DEBUG SQL:230 - delete from pyme_plan where empresa_id=?
11:34:45,266 DEBUG SQL:230 - delete from pyme_documento_presentado where empresa_id=?
11:34:45,269 DEBUG SQL:230 - delete from pyme_mercado_local where empresa_id=?
11:34:45,272 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,274 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,276 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,277 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,279 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,281 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,282 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,284 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,292 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,295 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,298 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,302 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,304 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,306 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,311 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,314 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,317 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,320 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,322 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,323 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,329 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,332 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:45,335 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,338 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,341 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:45,344 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,347 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,351 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,354 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,355 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,357 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,363 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,366 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,369 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,372 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,375 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,378 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,380 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,381 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,387 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,390 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:45,393 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,396 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,399 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,402 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,405 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,408 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,411 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,414 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,417 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,419 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,423 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,425 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,429 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,431 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,435 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,438 DEBUG SQL:230 - delete from pyme_exportacion where empresa_id=?
11:34:45,440 DEBUG SQL:230 - delete from pyme_cantidad_emp where empresa_id=?
11:34:45,443 DEBUG SQL:230 - delete from pyme_plan where empresa_id=?
11:34:45,492 DEBUG SQL:230 - delete from pyme_inversion where empresa_id=?
11:34:45,495 DEBUG SQL:230 - delete from pyme_cantidad_emp where empresa_id=?
11:34:45,498 DEBUG SQL:230 - delete from pyme_plan where empresa_id=?
11:34:45,504 DEBUG SQL:230 - delete from pyme_documento_presentado where empresa_id=?
11:34:45,507 DEBUG SQL:230 - delete from pyme_inversion where empresa_id=?
11:34:45,509 DEBUG SQL:230 - delete from pyme_mercado_local where empresa_id=?
11:34:45,512 DEBUG SQL:230 - delete from pyme_cantidad_emp where empresa_id=?
11:34:45,515 DEBUG SQL:230 - delete from pyme_plan where empresa_id=?
11:34:45,521 DEBUG SQL:230 - delete from pyme_documento_presentado where empresa_id=?
11:34:45,524 DEBUG SQL:230 - delete from pyme_inversion where empresa_id=?
11:34:45,526 DEBUG SQL:230 - delete from pyme_mercado_local where empresa_id=?
11:34:45,529 DEBUG SQL:230 - delete from pyme_cantidad_emp where empresa_id=?
11:34:45,532 DEBUG SQL:230 - delete from pyme_plan where empresa_id=?
11:34:45,538 DEBUG SQL:230 - delete from pyme_documento_presentado where empresa_id=?
11:34:45,541 DEBUG SQL:230 - delete from pyme_inversion where empresa_id=?
11:34:45,544 DEBUG SQL:230 - delete from pyme_mercado_local where empresa_id=?
11:34:45,546 DEBUG SQL:230 - delete from pyme_exportacion where empresa_id=?
11:34:45,549 DEBUG SQL:230 - delete from pyme_cantidad_emp where empresa_id=?
11:34:45,552 DEBUG SQL:230 - delete from pyme_plan where empresa_id=?
11:34:45,558 DEBUG SQL:230 - delete from pyme_documento_presentado where empresa_id=?
11:34:45,561 DEBUG SQL:230 - delete from pyme_inversion where empresa_id=?
11:34:45,563 DEBUG SQL:230 - delete from pyme_mercado_local where empresa_id=?
11:34:45,566 DEBUG SQL:230 - delete from pyme_plan where plan_id=?
11:34:45,569 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,571 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,572 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,574 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,579 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,635 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,638 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:45,641 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,644 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,647 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,649 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,650 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,656 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,659 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:45,662 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,665 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,667 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,670 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:45,673 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,676 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,678 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,682 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,689 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,691 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,695 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,698 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,701 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,704 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,706 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,710 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,713 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,716 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,719 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,722 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,725 DEBUG SQL:230 - delete from pyme_plan where plan_id=?
11:34:45,728 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,730 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,732 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,734 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,736 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,737 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,739 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,741 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,742 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,744 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,745 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,747 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,749 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,750 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,752 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,754 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,772 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,774 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,776 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,777 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,779 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,781 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,782 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,792 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,795 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:45,798 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,801 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,803 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,805 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,806 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,808 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,814 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,817 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,819 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,823 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,826 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,829 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,832 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,835 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,838 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,841 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,844 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,847 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,851 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,854 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,857 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,860 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,863 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,866 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:45,869 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,872 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,874 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,875 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,877 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,879 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,885 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,888 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,891 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,894 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,897 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,900 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,902 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,905 DEBUG SQL:230 - delete from pyme_plan where plan_id=?
11:34:45,908 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,910 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,911 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,913 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,915 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,916 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,918 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,920 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:45,926 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,928 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,930 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,932 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,933 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,935 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,937 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,938 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,949 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,952 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,955 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,958 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,962 DEBUG SQL:230 - delete from informe_actividades where actividad_id=?
11:34:45,964 DEBUG SQL:230 - delete from informe_actividades where informe_id=?
11:34:45,967 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,970 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:45,973 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,976 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,979 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,983 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:45,985 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:45,988 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:45,991 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:45,994 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:45,996 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,001 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,004 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,007 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,010 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,013 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,016 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,019 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,022 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,024 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,026 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,030 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,033 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,036 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,039 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:46,042 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,045 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,048 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,052 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,055 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:46,057 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,061 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,062 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,064 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,066 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,071 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,074 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,077 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,084 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,087 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,090 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,093 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,095 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,096 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,102 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,105 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,108 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,111 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,114 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,117 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,120 DEBUG SQL:230 - delete from pyme_plan where plan_id=?
11:34:46,123 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,124 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,126 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,128 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,129 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,131 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,137 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,140 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,143 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,148 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,151 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,153 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,155 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,160 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,163 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,166 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,169 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,173 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,176 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,179 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,181 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,183 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,185 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,187 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,188 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,196 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,199 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:46,201 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,204 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,208 DEBUG SQL:230 - delete from proveedor_cantidad_emp where empresa_id=?
11:34:46,210 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,214 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,217 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,220 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,223 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,225 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,229 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,232 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,234 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,238 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,241 DEBUG SQL:230 - delete from pyme_plan where plan_id=?
11:34:46,288 DEBUG SQL:230 - delete from pyme_exportacion where empresa_id=?
11:34:46,291 DEBUG SQL:230 - delete from pyme_cantidad_emp where empresa_id=?
11:34:46,293 DEBUG SQL:230 - delete from pyme_plan where empresa_id=?
11:34:46,296 DEBUG SQL:230 - delete from pyme_documento_presentado where empresa_id=?
11:34:46,299 DEBUG SQL:230 - delete from pyme_inversion where empresa_id=?
11:34:46,302 DEBUG SQL:230 - delete from pyme_mercado_local where empresa_id=?
11:34:46,305 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,307 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,308 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,311 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,313 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,315 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where solicitud_compra_id=?
11:34:46,320 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,324 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,327 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,330 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,332 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,336 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,339 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,340 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,342 DEBUG SQL:230 - delete from actividad_servicio where actividad_id=?
11:34:46,347 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,350 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,353 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,357 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,360 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,361 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,363 DEBUG SQL:230 - delete from proveedor_servicio where servicio_id=?
11:34:46,367 DEBUG SQL:230 - delete from proveedor_servicio where empresa_id=?
11:34:46,370 DEBUG SQL:230 - delete from autorizacion_pago_solicitud_compra where autorizacion_pago_id=?
11:34:46,472 DEBUG SQL:230 - insert into actividad_servicio (actividad_id, servicio_id) values (?, ?)
11:34:46,474 DEBUG SQL:230 - insert into actividad_servicio (actividad_id, servicio_id) values (?, ?)
11:34:46,481 DEBUG SQL:230 - insert into actividad_servicio (actividad_id, servicio_id) values (?, ?)
11:34:46,484 DEBUG SQL:230 - insert into actividad_servicio (actividad_id, servicio_id) values (?, ?)
11:34:46,487 DEBUG SQL:230 - insert into actividad_servicio (actividad_id, servicio_id) values (?, ?)
11:34:46,489 DEBUG SQL:230 - insert into actividad_servicio (actividad_id, servicio_id) values (?, ?)
11:34:46,492 DEBUG SQL:230 - insert into actividad_servicio (actividad_id, servicio_id) values (?, ?)
11:34:46,496 DEBUG SQL:230 - insert into actividad_servicio (actividad_id, servicio_id) values (?, ?)
11:34:46,499 DEBUG SQL:230 - insert into actividad_servicio (actividad_id, servicio_id) values (?, ?)
11:34:46,508 DEBUG SQL:230 - insert into proveedor_servicio (servicio_id, empresa_id) values (?, ?)
11:34:46,512 DEBUG SQL:230 - insert into proveedor_servicio (empresa_id, servicio_id) values (?, ?)
11:34:46,515 DEBUG SQL:230 - insert into proveedor_servicio (empresa_id, servicio_id) values (?, ?)
11:34:46,518 DEBUG SQL:230 - insert into proveedor_servicio (empresa_id, servicio_id) values (?, ?)
11:34:46,520 DEBUG SQL:230 - insert into proveedor_servicio (empresa_id, servicio_id) values (?, ?)
11:34:46,522 DEBUG SQL:230 - insert into proveedor_servicio (empresa_id, servicio_id) values (?, ?)
11:34:46,525 DEBUG SQL:230 - insert into proveedor_servicio (empresa_id, servicio_id) values (?, ?)
and here is the DAO root class:
Code:
public abstract class _BaseRootDAO {
protected static Map sessionFactoryMap = new HashMap();
protected static ThreadLocal threadedSessions = new ThreadLocal();
/**
* Configure the session factory by reading hibernate config file
*/
public static void initialize() throws HibernateException {
initialize((String) null);
}
/**
* Configure the session factory by reading hibernate config file
* @param configFileName the name of the configuration file
*/
public static void initialize(String configFileName) throws HibernateException {
if (null == configFileName && sessionFactoryMap.size() > 0) return;
else if (null != sessionFactoryMap.get(configFileName)) return;
else {
Configuration cfg = new Configuration();
if (null == configFileName)
cfg.configure();
else
cfg.configure(configFileName);
setSessionFactory(configFileName, cfg.buildSessionFactory());
}
}
/**
* Set the session factory
*/
protected static void setSessionFactory(SessionFactory sessionFactory) {
setSessionFactory((String) null, sessionFactory);
}
/**
* Set the session factory
*/
protected static void setSessionFactory(String configFileName, SessionFactory sessionFactory) {
sessionFactoryMap.put(configFileName, sessionFactory);
}
/**
* Return the SessionFactory that is to be used by these DAOs. Change this
* and implement your own strategy if you, for example, want to pull the SessionFactory
* from the JNDI tree.
*/
protected SessionFactory getSessionFactory() throws HibernateException {
return getSessionFactory(getConfigurationFileName());
}
private static SessionFactory getSessionFactory(String configFile) throws HibernateException {
if (sessionFactoryMap.size() == 1) return (SessionFactory) sessionFactoryMap.values().toArray()[0];
else {
SessionFactory sessionFactory = (SessionFactory) sessionFactoryMap.get(configFile);
if (null == sessionFactory)
if (null == configFile)
throw new RuntimeException("The session factory has not been initialized.");
else
throw new RuntimeException("The session factory for '" + configFile + "' has not been initialized.");
else
return sessionFactory;
}
}
/**
* Return a new Session object that must be closed when the work has been completed.
* @return the active Session
*/
protected Session getSession() throws HibernateException {
return createSession();
}
/**
* Return a new Session object that must be closed when the work has been completed.
* @return the active Session
*/
public static Session createSession() throws HibernateException {
return createSession(null);
}
/**
* Return a new Session object that must be closed when the work has been completed.
* @param configFile the config file must match the meta attribute "config-file" in the hibernate mapping file
* @return the active Session
*/
public static Session createSession(String configFile) throws HibernateException {
java.util.Stack sessionStack = (java.util.Stack) threadedSessions.get();
Session session = null;
if (null == sessionStack) {
sessionStack = new java.util.Stack();
threadedSessions.set(sessionStack);
}
if (sessionStack.size() > 0) {
Object[] arr = (Object[]) sessionStack.peek();
String cf = (String) arr[0];
if (null == cf) {
session = (Session) arr[1];
}
else if (null != cf && null != configFile) {
if (cf.equals(configFile)) session = (Session) arr[1];
}
if (null == session) {
session = getSessionFactory(configFile).openSession();
arr = new Object[2];
arr[0] = configFile;
arr[1] = session;
sessionStack.push(arr);
}
}
else {
session = getSessionFactory(configFile).openSession();
Object[] arr = new Object[2];
arr = new Object[2];
arr[0] = configFile;
arr[1] = session;
sessionStack.push(arr);
}
return session;
}
/**
* Return the name of the configuration file to be used with this DAO or null if default
*/
public String getConfigurationFileName() {
return null;
}
/**
* Return the specific Object class that will be used for class-specific
* implementation of this DAO.
* @return the reference Class
*/
public abstract Class getReferenceClass();
/**
* Close the session
*/
public void closeSession() throws HibernateException {
java.util.Stack sessionStack = (java.util.Stack) threadedSessions.get();
if (null != sessionStack) {
Object[] arr = (Object[]) sessionStack.peek();
String cf = (String) arr[0];
if (null == cf) {
Session session = (Session) arr[1];
session.close();
sessionStack.pop();
}
else {
String configurationFile = getConfigurationFileName();
if (null != configurationFile && configurationFile.equals(cf)) {
Session session = (Session) arr[1];
session.close();
sessionStack.pop();
}
}
}
}
/**
* Begin the transaction related to the session
*/
public Transaction beginTransaction(Session s) throws HibernateException {
return s.beginTransaction();
}
/**
* Commit the given transaction
*/
public void commitTransaction(Transaction t) throws HibernateException {
t.commit();
}
/**
* Obtain an instance of Query for a named query string defined in the mapping file.
* @param name the name of a query defined externally
* @return Query
*/
public List getNamedQuery(String name) throws HibernateException {
Session s = null;
try {
s = getSession();
return getNamedQuery(name, s);
} finally {
closeSession();
}
}
/**
* Obtain an instance of Query for a named query string defined in the mapping file.
* Use the session given.
* @param name the name of a query defined externally
* @param s the Session
* @return Query
*/
public List getNamedQuery(String name, Session s) throws HibernateException {
Query q = s.getNamedQuery(name);
return q.list();
}
/**
* Obtain an instance of Query for a named query string defined in the mapping file.
* Use the parameters given.
* @param name the name of a query defined externally
* @param params the parameter array
* @return Query
*/
public List getNamedQuery(String name, Serializable[] params)
throws HibernateException {
Session s = null;
try {
s = getSession();
return getNamedQuery(name, params, s);
} finally {
closeSession();
}
}
/**
* Obtain an instance of Query for a named query string defined in the mapping file.
* Use the parameters given and the Session given.
* @param name the name of a query defined externally
* @param params the parameter array
* @s the Session
* @return Query
*/
public List getNamedQuery(String name, Serializable[] params, Session s)
throws HibernateException {
Query q = s.getNamedQuery(name);
if (null != params) {
for (int i = 0; i < params.length; i++) {
setParameterValue(q, i, params[i]);
}
}
return q.list();
}
/**
* Obtain an instance of Query for a named query string defined in the mapping file.
* Use the parameters given.
* @param name the name of a query defined externally
* @param params the parameter Map
* @return Query
*/
public List getNamedQuery(String name, Map params)
throws HibernateException {
Session s = null;
try {
s = getSession();
return getNamedQuery(name, params, s);
} finally {
closeSession();
}
}
/**
* Obtain an instance of Query for a named query string defined in the mapping file.
* Use the parameters given and the Session given.
* @param name the name of a query defined externally
* @param params the parameter Map
* @s the Session
* @return Query
*/
public List getNamedQuery(String name, Map params, Session s)
throws HibernateException {
Query q = s.getNamedQuery(name);
if (null != params) {
for (Iterator i=params.entrySet().iterator(); i.hasNext(); ) {
Map.Entry entry = (Map.Entry) i.next();
setParameterValue(q, (String) entry.getKey(), entry.getValue());
}
}
return q.list();
}
/**
* Return a Criteria object that relates to the DAO's table.
* A session will be created if an open one is not located. This session must be closed!
*/
public Criteria createCriteria() throws HibernateException {
Session s = getSession();
return createCriteria(s);
}
/**
* Return a Criteria object that relates to the DAO's table
*/
public Criteria createCriteria(Session s) throws HibernateException {
return s.createCriteria(getReferenceClass());
}
/**
* Return the property of the class you would like to use for default ordering
* @return the property name
*/
/**
* Convenience method to set paramers in the query given based on the actual object type in passed in as the value.
* You may need to add more functionaly to this as desired (or not use this at all).
* @param query the Query to set
* @param position the ordinal position of the current parameter within the query
* @param value the object to set as the parameter
*/
public void setParameterValue(Query query, int position, Object value) {
if (null == value) {
return;
} else if (value instanceof Boolean) {
query.setBoolean(position, ((Boolean) value).booleanValue());
} else if (value instanceof String) {
query.setString(position, (String) value);
} else if (value instanceof Integer) {
query.setInteger(position, ((Integer) value).intValue());
} else if (value instanceof Long) {
query.setLong(position, ((Long) value).longValue());
} else if (value instanceof Float) {
query.setFloat(position, ((Float) value).floatValue());
} else if (value instanceof Double) {
query.setDouble(position, ((Double) value).doubleValue());
} else if (value instanceof BigDecimal) {
query.setBigDecimal(position, (BigDecimal) value);
} else if (value instanceof Byte) {
query.setByte(position, ((Byte) value).byteValue());
} else if (value instanceof Calendar) {
query.setCalendar(position, (Calendar) value);
} else if (value instanceof Character) {
query.setCharacter(position, ((Character) value).charValue());
} else if (value instanceof Timestamp) {
query.setTimestamp(position, (Timestamp) value);
} else if (value instanceof Date) {
query.setDate(position, (Date) value);
} else if (value instanceof Short) {
query.setShort(position, ((Short) value).shortValue());
}
}
/**
* Convenience method to set paramers in the query given based on the actual object type in passed in as the value.
* You may need to add more functionaly to this as desired (or not use this at all).
* @param query the Query to set
* @param key the key name
* @param value the object to set as the parameter
*/
public void setParameterValue(Query query, String key, Object value) {
if (null == key || null == value) {
return;
} else if (value instanceof Boolean) {
query.setBoolean(key, ((Boolean) value).booleanValue());
} else if (value instanceof String) {
query.setString(key, (String) value);
} else if (value instanceof Integer) {
query.setInteger(key, ((Integer) value).intValue());
} else if (value instanceof Long) {
query.setLong(key, ((Long) value).longValue());
} else if (value instanceof Float) {
query.setFloat(key, ((Float) value).floatValue());
} else if (value instanceof Double) {
query.setDouble(key, ((Double) value).doubleValue());
} else if (value instanceof BigDecimal) {
query.setBigDecimal(key, (BigDecimal) value);
} else if (value instanceof Byte) {
query.setByte(key, ((Byte) value).byteValue());
} else if (value instanceof Calendar) {
query.setCalendar(key, (Calendar) value);
} else if (value instanceof Character) {
query.setCharacter(key, ((Character) value).charValue());
} else if (value instanceof Timestamp) {
query.setTimestamp(key, (Timestamp) value);
} else if (value instanceof Date) {
query.setDate(key, (Date) value);
} else if (value instanceof Short) {
query.setShort(key, ((Short) value).shortValue());
}
}
/**
* Used by the base DAO classes but here for your modification
* Load object matching the given key and return it.
*/
public Object load(Class refClass, Serializable key) throws HibernateException {
Session s = null;
try {
s = getSession();
return load(refClass, key, s);
} finally {
closeSession();
}
}
/**
* Used by the base DAO classes but here for your modification
* Load object matching the given key and return it.
*/
public Object load(Class refClass, Serializable key, Session s) throws HibernateException {
return s.load(refClass, key);
}
/**
* Used by the base DAO classes but here for your modification
* Persist the given transient instance, first assigning a generated identifier.
* (Or using the current value of the identifier property if the assigned generator is used.)
*/
public Serializable save(Object obj) throws HibernateException {
Transaction t = null;
Session s = null;
try {
s = getSession();
t = beginTransaction(s);
Serializable rtn = save(obj, s);
commitTransaction(t);
return rtn;
}
catch (HibernateException e) {
if (null != t) t.rollback();
throw e;
}
finally {
closeSession();
}
}
/**
* Used by the base DAO classes but here for your modification
* Persist the given transient instance, first assigning a generated identifier.
* (Or using the current value of the identifier property if the assigned generator is used.)
*/
public Serializable save(Object obj, Session s) throws HibernateException {
return s.save(obj);
}
/**
* Used by the base DAO classes but here for your modification
* Either save() or update() the given instance, depending upon the value of its
* identifier property.
*/
public void saveOrUpdate(Object obj) throws HibernateException {
Transaction t = null;
Session s = null;
try {
s = getSession();
t = beginTransaction(s);
saveOrUpdate(obj, s);
commitTransaction(t);
}
catch (HibernateException e) {
if (null != t) t.rollback();
throw e;
}
finally {
closeSession();
}
}
/**
* Used by the base DAO classes but here for your modification
* Either save() or update() the given instance, depending upon the value of its
* identifier property.
*/
public void saveOrUpdate(Object obj, Session s) throws HibernateException {
s.saveOrUpdate(obj);
}
/**
* Used by the base DAO classes but here for your modification
* Update the persistent state associated with the given identifier. An exception is thrown if there is a persistent
* instance with the same identifier in the current session.
* @param obj a transient instance containing updated state
*/
public void update(Object obj) throws HibernateException {
Transaction t = null;
Session s = null;
try {
s = getSession();
t = beginTransaction(s);
update(obj, s);
commitTransaction(t);
}
catch (HibernateException e) {
if (null != t) t.rollback();
throw e;
}
finally {
closeSession();
}
}
/**
* Used by the base DAO classes but here for your modification
* Update the persistent state associated with the given identifier. An exception is thrown if there is a persistent
* instance with the same identifier in the current session.
* @param obj a transient instance containing updated state
* @param s the Session
*/
public void update(Object obj, Session s) throws HibernateException {
s.update(obj);
}
/**
* Used by the base DAO classes but here for your modification
* Remove a persistent instance from the datastore. The argument may be an instance associated with the receiving
* Session or a transient instance with an identifier associated with existing persistent state.
*/
public void delete(Object obj) throws HibernateException {
Transaction t = null;
Session s = null;
try {
s = getSession();
t = beginTransaction(s);
delete(obj, s);
commitTransaction(t);
}
catch (HibernateException e) {
if (null != t) t.rollback();
throw e;
}
finally {
closeSession();
}
}
/**
* Used by the base DAO classes but here for your modification
* Remove a persistent instance from the datastore. The argument may be an instance associated with the receiving
* Session or a transient instance with an identifier associated with existing persistent state.
*/
public void delete(Object obj, Session s) throws HibernateException {
s.delete(obj);
}
/**
* Used by the base DAO classes but here for your modification
* Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement
* long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances.
*/
public void refresh(Object obj, Session s) throws HibernateException {
s.refresh(obj);
}
/**Devuelve una lista desde una consulta de HQL*/
public List find(String query) throws HibernateException {
Session s = null;
try {
s = getSession();
return find(query, s);
}
finally {
closeSession();
}
}
/**Devuelve una lista desde una consulta de HQL en una sesión especificada.*/
public List find(String query, Session s) throws HibernateException {
return s.find(query);
}
/**Devuelve una lista de todos los objetos del tipo, sin filtro.*/
public List findAll() throws HibernateException {
Session s = null;
try {
s = getSession();
return findAll(s);
}
finally {
closeSession();
}
}
//Devuelve todos los objetos del tipo, sin filtro en la sesión especificada.
public List findAll(Session s) throws HibernateException {
return findAll(s, null, true);
}
/**Devuelve todos los objetos del tipo sin filtro ordenados por propiedad.*/
public List findAll(String orderProperty, boolean ascOrder) throws HibernateException {
Session s = null;
try {
s = getSession();
return findAll(s, orderProperty, ascOrder);
}
finally {
closeSession();
}
}
/**Devuelve todos los objetos del tipo, en una sesión sin filtro ordenados por una propiedad.*/
public List findAll(Session s, String orderProperty, boolean ascOrder) throws HibernateException {
Criteria crit = createCriteria(s);
if (null != orderProperty) crit.addOrder(Order.asc(orderProperty));
return crit.list();
}
/**Devuelve una lista filtrada por una propiedad.*/
public List filterBy(String propertyName, Object filter) throws HibernateException {
return filterBy(propertyName, filter, null, true);
}
/**Devuelve una lista filtrada por una propiedad, ordenada por una propiedad en forma ascendente o descendente.*/
public List filterBy(String propertyName, Object filter, String orderProperty, boolean ascOrder) throws HibernateException {
Session s = null;
try {
s = getSession();
return filterBy(s, propertyName, filter, orderProperty, ascOrder);
}
finally {
closeSession();
}
}
public List filterBetween(String propertyName, Object filterBottom, Object filterTop, String orderProperty, boolean ascOrder) throws HibernateException {
Session s = null;
try{
s = getSession();
Criteria crit = createCriteria(s);
crit.add(Expression.between(propertyName,filterBottom, filterTop));
if (null != orderProperty)
{
if (ascOrder==true)
crit.addOrder(Order.asc(orderProperty));
else
crit.addOrder(Order.desc(orderProperty));
}
return crit.list();
}
finally {
closeSession();
}
}
/**Devuelve una lista filtrada por una propiedad, ordenada por una propiedad, en una sesión especifica.*/
public List filterBy(Session s, String propertyName, Object filter, String orderProperty, boolean ascOrder) throws HibernateException {
Criteria crit = createCriteria(s);
if (filter instanceof String)
crit.add(Expression.like(propertyName,filter));
else
crit.add(Expression.eq(propertyName,filter));
if (null != orderProperty)
{
if (ascOrder==true)
crit.addOrder(Order.asc(orderProperty));
else
crit.addOrder(Order.desc(orderProperty));
}
return crit.list();
}
public java.util.List find(String query, Object obj, Type type) throws HibernateException {
Session s = null;
try {
s = getSession();
return find(query, obj, type, s);
}
finally {
closeSession();
}
}
public List find(String query, Object obj, Type type, Session s) throws HibernateException {
return s.find(query, obj, type);
}
public List find(String query, Object[] obj, Type[] type) throws HibernateException {
Session s = null;
try {
s = getSession();
return find(query, obj, type, s);
}
finally {
closeSession();
}
}
public List find(String query, Object[] obj, Type[] type, Session s) throws HibernateException {
return s.find(query, obj, type);
}
}
and I have the next line in every jsp:
_RootDAO.initialize();