Results 1 to 3 of 3

Thread: org.hibernate.AssertionFailure when calling save method on HibernateTemplate

  1. #1

    Default org.hibernate.AssertionFailure when calling save method on HibernateTemplate

    Hi,

    I am using HibernateTemplate. I have unique constraint on one of my entities. When trying to insert duplicate, I get org.hibernate.AssertionFailure. Should't Hibernate template wrap this with DataIntegrityViolationException? I am using spring 1.2.7 and hibernate 3.0.

    Thank you.

    Dan

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    get org.hibernate.AssertionFailure. Should't Hibernate template wrap this with DataIntegrityViolationException?
    No... AssertionFailure isn't a HibernateException it is a NestableRuntimeException only HibernateException(s) are converted. Also AssertionFailure indicates something else then your constraint violation...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default AssertionFailure is only exception that bubbles up

    Quote Originally Posted by mdeinum View Post
    No... AssertionFailure isn't a HibernateException it is a NestableRuntimeException only HibernateException(s) are converted. Also AssertionFailure indicates something else then your constraint violation...
    AssertionFailure is only exception that bubbles up. Log trace displays JDBCException, but all I can catch is AssertionFailure. I guess it is some problem with hibernate, but I wonder no one had similar experience before. Here is my trace:



    [30-10-07 11:10:18:200 VET] 00000036 JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL Error: 2627, SQLState: 23000

    [30-10-07 11:10:18:293 VET] 00000036 JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions Violation of UNIQUE KEY constraint 'CK_dynamicform_validator'. Cannot insert duplicate key in object 'dynamicform_validator'.

    [30-10-07 11:10:18:403 VET] 00000036 AssertionFail E org.hibernate.AssertionFailure <init> an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)

    org.hibernate.AssertionFailure: null id in net.excelsys.framework.dynamicform.dto.Validator entry (don't flush the Session after an exception occurs)

    at org.hibernate.event.def.DefaultFlushEntityEventLis tener.checkId(DefaultFlushEntityEventListener.java :48)

    at org.hibernate.event.def.DefaultFlushEntityEventLis tener.getValues(DefaultFlushEntityEventListener.ja va:150)

    at org.hibernate.event.def.DefaultFlushEntityEventLis tener.onFlushEntity(DefaultFlushEntityEventListene r.java:106)

    at org.hibernate.event.def.AbstractFlushingEventListe ner.flushEntities(AbstractFlushingEventListener.ja va:195)

    at org.hibernate.event.def.AbstractFlushingEventListe ner.flushEverythingToExecutions(AbstractFlushingEv entListener.java:76)

    at org.hibernate.event.def.DefaultFlushEventListener. onFlush(DefaultFlushEventListener.java:26)

    at org.hibernate.impl.SessionImpl.flush(SessionImpl.j ava:985)

    at org.hibernate.impl.SessionImpl.managedFlush(Sessio nImpl.java:333)

    at org.hibernate.transaction.JDBCTransaction.commit(J DBCTransaction.java:106)

    at org.springframework.orm.hibernate3.HibernateTransa ctionManager.doCommit(HibernateTransactionManager. java:584)

    at org.springframework.transaction.support.AbstractPl atformTransactionManager.processCommit(AbstractPla tformTransactionManager.java:500)

    at org.springframework.transaction.support.AbstractPl atformTransactionManager.commit(AbstractPlatformTr ansactionManager.java:473)

    at org.springframework.transaction.interceptor.Transa ctionAspectSupport.doCloseTransactionAfterThrowing (TransactionAspectSupport.java:302)

    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:100)

    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :170)

    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:176)

    at $Proxy8.save(Unknown Source)

    at net.excelsys.framework.dynamicform.data.ValidatorD ata.save(ValidatorData.java:26)

    at net.excelsys.framework.dynamicform.struts.action.v alidator.ValidatorSaveAction.execute(ValidatorSave Action.java:70)

    at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:484)

    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:274)

    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1482)

    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:525)

    at javax.servlet.http.HttpServlet.service(HttpServlet .java:763)

    at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1572)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1521)

    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.d oFilter(WebAppFilterChain.java:136)

    at net.excelsys.framework.commons.filter.OpenSessionF ilter.doFilterInternal(OpenSessionFilter.java:121)

    at org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:76)

    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapp er.doFilter(FilterInstanceWrapper.java:142)

    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.d oFilter(WebAppFilterChain.java:121)

    at com.ibm.ws.webcontainer.filter.WebAppFilterChain._ doFilter(WebAppFilterChain.java:82)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.han dleRequest(ServletWrapper.java:759)

    at com.ibm.ws.webcontainer.servlet.CacheServletWrappe r.handleRequest(CacheServletWrapper.java:89)

    at com.ibm.ws.webcontainer.WebContainer.handleRequest (WebContainer.java:1924)

    at com.ibm.ws.webcontainer.channel.WCChannelLink.read y(WCChannelLink.java:98)

    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleDiscrimination(HttpInboundLink.java:472)

    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleNewInformation(HttpInboundLink.java:411)

    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCa llback.complete(HttpICLReadCallback.java:101)

    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.reque stComplete(WorkQueueManager.java:566)

    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attem ptIO(WorkQueueManager.java:619)

    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.worke rRun(WorkQueueManager.java:952)

    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worke r.run(WorkQueueManager.java:1039)

    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1471)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •