2 Replies Latest reply on Mar 22, 2010 2:11 PM by sai burgula

    could not insert exception when trying to insert a row

    sai burgula Novice
      I have an entity Fce which has certain parameters which are defined in the DB as number(1). They take a single numeric integer as a value. Now the entity I have is defined as follows:

      @Entity
      @Table(name = "FCE", schema = "KARYN")
      public class Fce implements java.io.Serializable {

      private static final long serialVersionUID = 1L;

      private FceId id;
      private Short courseTotal;
      private String semOrder;
      private BigDecimal objective;
      private BigDecimal exams;
      private BigDecimal assignments;
      private BigDecimal lectures;
      private BigDecimal discussions;
      private BigDecimal relevancy;
      private BigDecimal overallRating;
      private Date dateEntered;
      private String enteredBy;
      private String updatedBy;
      private Date dateUpdated;
      private CourseOffering courseOffering;
      }

      I am referring to the parameters defined as BigDecimal in this entity. They are defined as Number(1) in the DB. And they are all nullable. Now I am trying to insert a row into the table FCE. And i get the following exception.

      java.lang.NoSuchMethodError: edu.cmu.heinz.hcis.entity.Fce.getObjective()Ljava/lang/Short;
      javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: java.lang.NoSuchMethodError: edu.cmu.heinz.hcis.entity.Fce.getObjective()Ljava/lang/Short;
      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
      at javax.faces.component.UICommand.broadcast(UICommand.java:387)
      at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
      at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
      at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
      at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Unknown Source)
      Caused by: javax.ejb.EJBTransactionRolledbackException: java.lang.NoSuchMethodError: edu.cmu.heinz.hcis.entity.Fce.getObjective()Ljava/lang/Short;
      at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
      at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:94)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:108)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
      at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:117)
      at $Proxy256.addFacultyCourseEval(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
      at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
      at org.javassist.tmp.java.lang.Object_$$_javassist_3.addFacultyCourseEval(Object_$$_javassist_3.java)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
      at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274)
      at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
      at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
      at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
      at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
      at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
      ... 49 more


      It seems like it is expecting Short. The problem is that it does not end there. I have changed it to Short and tried it as well.

      Then I get the following error.


      ------------------------------------------------------------------------------------------------------------------
      Hibernate:
      select
      fce0_.COURSE_NO as COURSE1_46_0_,
      fce0_.SECTION as SECTION46_0_,
      fce0_.SEMESTER as SEMESTER46_0_,
      fce0_.SEQUENCE_NO as SEQUENCE4_46_0_,
      fce0_.ASSIGNMENTS as ASSIGNME5_46_0_,
      fce0_.COURSE_TOTAL as COURSE6_46_0_,
      fce0_.DATE_ENTERED as DATE7_46_0_,
      fce0_.DATE_UPDATED as DATE8_46_0_,
      fce0_.DISCUSSIONS as DISCUSSI9_46_0_,
      fce0_.ENTERED_BY as ENTERED10_46_0_,
      fce0_.EXAMS as EXAMS46_0_,
      fce0_.LECTURES as LECTURES46_0_,
      fce0_.OBJECTIVE as OBJECTIVE46_0_,
      fce0_.OVERALL_RATING as OVERALL14_46_0_,
      fce0_.RELEVANCY as RELEVANCY46_0_,
      fce0_.SEM_ORDER as SEM16_46_0_,
      fce0_.UPDATED_BY as UPDATED17_46_0_
      from
      KARYN.FCE fce0_
      where
      fce0_.COURSE_NO=?
      and fce0_.SECTION=?
      and fce0_.SEMESTER=?
      and fce0_.SEQUENCE_NO=?
      16:52:37,495 INFO [STDOUT] Hibernate:
      select
      fceins0_.COURSE_NO as COURSE1_57_0_,
      fceins0_.FAC_ID as FAC2_57_0_,
      fceins0_.SECTION as SECTION57_0_,
      fceins0_.SEMESTER as SEMESTER57_0_,
      fceins0_.SEQUENCE_NO as SEQUENCE5_57_0_,
      fceins0_.ANSWER_N_FEEDBACK as ANSWER6_57_0_,
      fceins0_.CRITICAL_THINKING as CRITICAL7_57_0_,
      fceins0_.DATE_ENTERED as DATE8_57_0_,
      fceins0_.DATE_UPDATED as DATE9_57_0_,
      fceins0_.ENTERED_BY as ENTERED10_57_0_,
      fceins0_.ENTHUSIASM as ENTHUSIASM57_0_,
      fceins0_.OVERALL_RATING as OVERALL12_57_0_,
      fceins0_.SEM_ORDER as SEM13_57_0_,
      fceins0_.UPDATED_BY as UPDATED14_57_0_
      from
      KARYN.FCE_INS fceins0_
      where
      fceins0_.COURSE_NO=?
      and fceins0_.FAC_ID=?
      and fceins0_.SECTION=?
      and fceins0_.SEMESTER=?
      and fceins0_.SEQUENCE_NO=?
      16:52:37,495 INFO [STDOUT] Hibernate:
      select
      fceta0_.COURSE_NO as COURSE1_56_0_,
      fceta0_.SECTION as SECTION56_0_,
      fceta0_.SEMESTER as SEMESTER56_0_,
      fceta0_.SEQUENCE_NO as SEQUENCE4_56_0_,
      fceta0_.TA_ID as TA5_56_0_,
      fceta0_.AVAILABLITY as AVAILABL6_56_0_,
      fceta0_.COMMUNICATION as COMMUNIC7_56_0_,
      fceta0_.DATE_ENTERED as DATE8_56_0_,
      fceta0_.DATE_UPDATED as DATE9_56_0_,
      fceta0_.ENTERED_BY as ENTERED10_56_0_,
      fceta0_.ENTHUSIASM as ENTHUSIASM56_0_,
      fceta0_.OVERALL_RATING as OVERALL12_56_0_,
      fceta0_.PATIENCE as PATIENCE56_0_,
      fceta0_.SEM_ORDER as SEM14_56_0_,
      fceta0_.UPDATED_BY as UPDATED15_56_0_
      from
      KARYN.FCE_TA fceta0_
      where
      fceta0_.COURSE_NO=?
      and fceta0_.SECTION=?
      and fceta0_.SEMESTER=?
      and fceta0_.SEQUENCE_NO=?
      and fceta0_.TA_ID=?
      16:52:37,557 INFO [STDOUT] Hibernate:
      insert
      into
      KARYN.FCE
      (ASSIGNMENTS, COURSE_TOTAL, DATE_ENTERED, DATE_UPDATED, DISCUSSIONS, ENTERED_BY, EXAMS, LECTURES, OBJECTIVE, OVERALL_RATING, RELEVANCY, SEM_ORDER, UPDATED_BY, COURSE_NO, SECTION, SEMESTER, SEQUENCE_NO)
      values
      (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
      16:52:37,557 INFO [STDOUT] Invalid Value: #0--semester
      16:52:37,557 INFO [STDOUT] Invalid Value: #0--courseNo
      16:52:37,557 INFO [STDOUT] Invalid Value: #0--section
      16:52:37,557 INFO [STDOUT] mode is viewFacCourseEval
      16:52:37,636 INFO [STDOUT] Hibernate:
      insert
      into
      KARYN.FCE
      (ASSIGNMENTS, COURSE_TOTAL, DATE_ENTERED, DATE_UPDATED, DISCUSSIONS, ENTERED_BY, EXAMS, LECTURES, OBJECTIVE, OVERALL_RATING, RELEVANCY, SEM_ORDER, UPDATED_BY, COURSE_NO, SECTION, SEMESTER, SEQUENCE_NO)
      values
      (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
      16:52:37,636 INFO [ShortType] could not bind value '3' to parameter: 1; The statement is closed.
      16:52:37,636 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
      16:52:37,636 ERROR [JDBCExceptionReporter] The statement is closed.
      16:52:37,636 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
      org.hibernate.exception.GenericJDBCException: could not insert: [edu.cmu.heinz.hcis.entity.Fce]
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2267)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
      at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:56)
      at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
      at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
      at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
      at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:523)
      at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
      at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:247)
      at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
      at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
      at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1406)
      at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
      at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
      at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:146)
      at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52)
      at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:603)
      at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:341)
      at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:241)
      at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:192)
      at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)

      ------------------------------------------------------------------------------------------------------------------

      If you see this it is trying to insert data into FCE but there is a mismatch from the data I am trying to insert and to the column it is trying to insert it into.

      I dont see the reason why there should be this mismatch. I generated the entity through Hibernate Tools. So what is going on here. Kindly do let me know if anyone has any idea.

      I would look forward for a quick response on this pls.

      thanks
      Sai
        • 1. Re: could not insert exception when trying to insert a row
          sai burgula Novice
          If anyone would like to see rest of the class Fce, then here it is:

               public Fce() {
               }

               public Fce(FceId id) {
                    this.id = id;
               }

               public Fce(FceId id, Short courseTotal, String semOrder, Short objective,
                         Short exams, Short assignments, Short lectures,
                         Short discussions, Short relevancy, Short overallRating,
                         Date dateEntered, String enteredBy, String updatedBy,
                         Date dateUpdated, CourseOffering courseOffering) {
                    this.id = id;
                    this.courseTotal = courseTotal;
                    this.semOrder = semOrder;
                    this.objective = objective;
                    this.exams = exams;
                    this.assignments = assignments;
                    this.lectures = lectures;
                    this.discussions = discussions;
                    this.relevancy = relevancy;
                    this.overallRating = overallRating;
                    this.dateEntered = dateEntered;
                    this.enteredBy = enteredBy;
                    this.updatedBy = updatedBy;
                    this.dateUpdated = dateUpdated;
                    this.courseOffering = courseOffering;
               }

               @EmbeddedId
               @AttributeOverrides( {
                         @AttributeOverride(name = "semester", column = @Column(name = "SEMESTER", nullable = false, length = 3)),
                         @AttributeOverride(name = "courseNo", column = @Column(name = "COURSE_NO", nullable = false, length = 8)),
                         @AttributeOverride(name = "section", column = @Column(name = "SECTION", nullable = false, length = 2)),
                         @AttributeOverride(name = "sequenceNo", column = @Column(name = "SEQUENCE_NO", nullable = false, precision = 11, scale = 0)) })
               @NotNull
               public FceId getId() {
                    return this.id;
               }

               public void setId(FceId id) {
                    this.id = id;
               }

               @Column(name = "COURSE_TOTAL", precision = 3, scale = 0)
               public Short getCourseTotal() {
                    return this.courseTotal;
               }

               public void setCourseTotal(Short courseTotal) {
                    this.courseTotal = courseTotal;
               }

               @Column(name = "SEM_ORDER", length = 5)
               @Length(max = 5)
               public String getSemOrder() {
                    return this.semOrder;
               }

               public void setSemOrder(String semOrder) {
                    this.semOrder = semOrder;
               }

               @Column(name = "OBJECTIVE", precision = 1, scale = 0)
               public Short getObjective() {
                    return this.objective;
               }

               public void setObjective(Short objective) {
                    this.objective = objective;
               }

               @Column(name = "EXAMS", precision = 1, scale = 0)
               public Short getExams() {
                    return this.exams;
               }

               public void setExams(Short exams) {
                    this.exams = exams;
               }

               @Column(name = "ASSIGNMENTS", precision = 1, scale = 0)
               public Short getAssignments() {
                    return this.assignments;
               }

               public void setAssignments(Short assignments) {
                    this.assignments = assignments;
               }

               @Column(name = "LECTURES", precision = 1, scale = 0)
               public Short getLectures() {
                    return this.lectures;
               }

               public void setLectures(Short lectures) {
                    this.lectures = lectures;
               }

               @Column(name = "DISCUSSIONS", precision = 1, scale = 0)
               public Short getDiscussions() {
                    return this.discussions;
               }

               public void setDiscussions(Short discussions) {
                    this.discussions = discussions;
               }

               @Column(name = "RELEVANCY", precision = 1, scale = 0)
               public Short getRelevancy() {
                    return this.relevancy;
               }

               public void setRelevancy(Short relevancy) {
                    this.relevancy = relevancy;
               }

               @Column(name = "OVERALL_RATING", precision = 1, scale = 0)
               public Short getOverallRating() {
                    return this.overallRating;
               }

               public void setOverallRating(Short overallRating) {
                    this.overallRating = overallRating;
               }

               @Temporal(TemporalType.DATE)
               @Column(name = "DATE_ENTERED", length = 7)
               public Date getDateEntered() {
                    return this.dateEntered;
               }

               public void setDateEntered(Date dateEntered) {
                    this.dateEntered = dateEntered;
               }

               @Column(name = "ENTERED_BY", length = 40)
               @Length(max = 40)
               public String getEnteredBy() {
                    return this.enteredBy;
               }

               public void setEnteredBy(String enteredBy) {
                    this.enteredBy = enteredBy;
               }

               @Column(name = "UPDATED_BY", length = 40)
               @Length(max = 40)
               public String getUpdatedBy() {
                    return this.updatedBy;
               }

               public void setUpdatedBy(String updatedBy) {
                    this.updatedBy = updatedBy;
               }

               @Temporal(TemporalType.DATE)
               @Column(name = "DATE_UPDATED", length = 7)
               public Date getDateUpdated() {
                    return this.dateUpdated;
               }

               public void setDateUpdated(Date dateUpdated) {
                    this.dateUpdated = dateUpdated;
               }
               
               @ManyToOne(fetch = FetchType.LAZY)
               @JoinColumns( {
                         @JoinColumn(name = "SEMESTER", referencedColumnName = "SEMESTER", nullable = false, insertable = false, updatable = false),
                         @JoinColumn(name = "COURSE_NO", referencedColumnName = "COURSE_NO", nullable = false, insertable = false, updatable = false),
                         @JoinColumn(name = "SECTION", referencedColumnName = "SECTION", nullable = false, insertable = false, updatable = false) })
               public CourseOffering getCourseOffering() {
                    return courseOffering;
               }

               public void setCourseOffering(CourseOffering courseOffering) {
                    this.courseOffering = courseOffering;
               }


          • 2. Re: could not insert exception when trying to insert a row
            sai burgula Novice
            Also I am going to post the embedded Id FceId:
            ----------------------------------------------



            @Embeddable
            public class FceId implements java.io.Serializable {

                 private String semester;
                 private String courseNo;
                 private String section;
                 private long sequenceNo;

                 public FceId() {
                 }

                 public FceId(String semester, String courseNo, String section,
                           long sequenceNo) {
                      this.semester = semester;
                      this.courseNo = courseNo;
                      this.section = section;
                      this.sequenceNo = sequenceNo;
                 }

                 @Column(name = "SEMESTER", nullable = false, length = 3)
                 @NotNull
                 @Length(max = 3)
                 public String getSemester() {
                      return this.semester;
                 }

                 public void setSemester(String semester) {
                      this.semester = semester;
                 }

                 @Column(name = "COURSE_NO", nullable = false, length = 8)
                 @NotNull
                 @Length(max = 8)
                 public String getCourseNo() {
                      return this.courseNo;
                 }

                 public void setCourseNo(String courseNo) {
                      this.courseNo = courseNo;
                 }

                 @Column(name = "SECTION", nullable = false, length = 2)
                 @NotNull
                 @Length(max = 2)
                 public String getSection() {
                      return this.section;
                 }

                 public void setSection(String section) {
                      this.section = section;
                 }

                 @Column(name = "SEQUENCE_NO", nullable = false, precision = 11, scale = 0)
                 @NotNull
                 public long getSequenceNo() {
                      return this.sequenceNo;
                 }

                 public void setSequenceNo(long sequenceNo) {
                      this.sequenceNo = sequenceNo;
                 }

                 public boolean equals(Object other) {
                      if ((this == other))
                           return true;
                      if ((other == null))
                           return false;
                      if (!(other instanceof FceId))
                           return false;
                      FceId castOther = (FceId) other;

                      return ((this.getSemester() == castOther.getSemester()) || (this
                                .getSemester() != null
                                && castOther.getSemester() != null && this.getSemester()
                                .equals(castOther.getSemester())))
                                && ((this.getCourseNo() == castOther.getCourseNo()) || (this
                                          .getCourseNo() != null
                                          && castOther.getCourseNo() != null && this
                                          .getCourseNo().equals(castOther.getCourseNo())))
                                && ((this.getSection() == castOther.getSection()) || (this
                                          .getSection() != null
                                          && castOther.getSection() != null && this.getSection()
                                          .equals(castOther.getSection())))
                                && (this.getSequenceNo() == castOther.getSequenceNo());
                 }

                 public int hashCode() {
                      int result = 17;

                      result = 37 * result
                                + (getSemester() == null ? 0 : this.getSemester().hashCode());
                      result = 37 * result
                                + (getCourseNo() == null ? 0 : this.getCourseNo().hashCode());
                      result = 37 * result
                                + (getSection() == null ? 0 : this.getSection().hashCode());
                      result = 37 * result + (int) this.getSequenceNo();
                      return result;
                 }


            Looking forward for a reply soon.