-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Exception in One-to One mapping while using ForeignGenerator
PostPosted: Tue Apr 03, 2012 4:16 pm 
Newbie

Joined: Mon Nov 26, 2007 2:30 am
Posts: 4
Location: New York
Does anyone have any idea on this? I have posted another thread for this but bo replies??

below are my mappings
Code:
<hibernate-mapping package="com.peanuts.blackboard.database.dto">
     <class name="com.peanuts.blackboard.database.dto.UserPersonalInfoDTO" table="users.UserPersonalInfo">
          <id name="userId" type="java.lang.Integer" column="UserId" unsaved-value="any">
                <generator class="org.hibernate.id.ForeignGenerator">
                    <param name="property">userDTO</param>
      <!--  <param name="column">NEXT</param> -->
               </generator>
          </id>
<one-to-one name="userDTO" class="com.peanuts.blackboard.database.dto.UserDTO" constrained="true" ></one-to-one>          
<property column="UserFirstName" name="userFirstName" type="java.lang.String" not-null="true"/>
<property column="UserLastName" name="userLastName" type="java.lang.String" not-null="true"/>
<property column="UserEmail" name="userEmail" type="java.lang.String" not-null="true"/>
<property column="UserContactNumber" name="userContactNumber" type="java.lang.String" not-null="true"/>
<property column="UserAddress" name="userAddress" type="java.lang.String" not-null="true"/>
<!-- <property column="CREATION_DATE" length="4" name="creationDate" type="java.util.Date"/>
<property column="CREATED_BY" name="createdBy" type="java.lang.Double"/>
<property column="MODIFICATION_DATE" length="4" name="modificationDate" type="java.util.Date"/>
<property column="MODIFIED_BY" name="modifiedBy" type="java.lang.Double"/>
<property column="DELETE_DATE" length="4" name="deleteDate" type="java.util.Date"/>
<property column="DELETED_BY" name="deletedBy" type="java.lang.Double"/> -->
     </class>
</hibernate-mapping>



Code:
<hibernate-mapping package="com.peanuts.blackboard.database.dto">
     <class name="com.peanuts.blackboard.database.dto.UserDTO" table="users.User">
          <id name="userId"  type="java.lang.Integer" column="UserId" unsaved-value="any">
         <generator class="native">
             <!--       <param name="property">userPersonalInfoDTO</param>
<param name="column">NEXT</param> -->
               </generator>       
          </id>
  <one-to-one name="userPersonalInfoDTO" class="com.peanuts.blackboard.database.dto.UserPersonalInfoDTO"  cascade="all" ></one-to-one>
<property column="UserName" name="userName" type="java.lang.String" not-null="true"/>
<property column="UserSchoolId" name="userSchoolId" type="java.lang.Integer" not-null="true"/>
<property column="UserPassword" name="userPassword" type="java.lang.String"/>
<property column="UserRole" name="userRole" type="java.lang.String" not-null="true"/>
<property column="UserStatus" name="userStatus" type="java.lang.String" not-null="true"/>
<!-- <property column="CREATION_DATE" length="4" name="creationDate" type="java.util.Date"/>
<property column="CREATED_BY" name="createdBy" type="java.lang.Double"/>
<property column="MODIFICATION_DATE" length="4" name="modificationDate" type="java.util.Date"/>
<property column="MODIFIED_BY" name="modifiedBy" type="java.lang.Double"/>
<property column="DELETE_DATE" length="4" name="deleteDate" type="java.util.Date"/>
<property column="DELETED_BY" name="deletedBy" type="java.lang.Double"/> -->
     </class>
</hibernate-mapping>


and here is exception

Code:
java.lang.NullPointerException
   at org.hibernate.tuple.entity.AbstractEntityTuplizer.getPropertyValue(AbstractEntityTuplizer.java:521)
   at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyValue(AbstractEntityPersister.java:3867)
   at org.hibernate.id.ForeignGenerator.generate(ForeignGenerator.java:100)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
   at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
   at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
   at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:713)
   at org.hibernate.impl.SessionImpl.save(SessionImpl.java:701)
   at org.hibernate.impl.SessionImpl.save(SessionImpl.java:697)
   at com.peanuts.blackboard.database.dao.impl.StudentDAO.savenewStudent(StudentDAO.java:74)
   at com.peanuts.blackboard.database.dao.impl.StudentDAO$$FastClassByCGLIB$$28a91834.invoke(<generated>)
   at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
   at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
   at com.peanuts.blackboard.database.dao.impl.StudentDAO$$EnhancerByCGLIB$$946d8675.savenewStudent(<generated>)
   at com.peanuts.blackboard.bus.svc.impl.StudentManager.savenewStudent(StudentManager.java:36)
   at com.peanuts.blackboard.web.controller.admin.AdminAddUserController.onSubmit(AdminAddUserController.java:72)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
   at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
   at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at com.springsource.insight.collection.tcserver.request.HttpRequestOperationCollectionValve.invoke(HttpRequestOperationCollectionValve.java:84)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
   at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)


I have searched a lot but found no solution for this. Pleeeaase help. Is this a possible bug ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.