テーブルで「シンプル」を実行していたところ、このエラーが発生しました。ネットを検索しても役に立ちませんでした。
主キーのソースとしてシーケンスを使用して接続されていると思います。
助けていただけますか?ありがとう
実行しようとしているコード (エラーをスローする部分を強調表示しました)
EventInstance eventInstance = (EventInstance) sessionFactory.getCurrentSession().get(EventInstance.class, userEventRegistration.getEventInstance().getInstanceId());
Student student = (Student) sessionFactory.getCurrentSession().get(Student.class, userEventRegistration.getStudent().getStudentId());
EventRegistration eventRegistration = new EventRegistration();
if (student == null) {
student = new Student();
student.setStudentId(userEventRegistration.getStudent().getStudentId());
}
student.setFamilyName(userEventRegistration.getStudent().getFamilyName());
student.setGivenName(userEventRegistration.getStudent().getGivenName());
student.setGender(userEventRegistration.getStudent().getGender());
student.setEmail(userEventRegistration.getStudent().getEmail());
student.setHomeCountry(userEventRegistration.getStudent().getHomeCountry());
student.setCourse(userEventRegistration.getStudent().getCourse());
student.setAccomodationName(userEventRegistration.getStudent().getAccomodationName());
student.setAddress(userEventRegistration.getStudent().getAddress());
student.setAddressCity(userEventRegistration.getStudent().getAddressCity());
student.setContactPhone(userEventRegistration.getStudent().getContactPhone());
student.setContactDetailsStatus(userEventRegistration.getStudent().getContactDetailsStatus());
student.setContactDetailsDate(userEventRegistration.getStudent().getContactDetailsDate());
student.setScholarships(userEventRegistration.getStudent().getScholarships());
student.setDietaryRestrictions(userEventRegistration.getStudent().getDietaryRestrictions());
student.setStudentComments(userEventRegistration.getStudent().getStudentComments());
student.setInternalComments(userEventRegistration.getStudent().getInternalComments());
eventRegistration.setEventInstance(eventInstance);
eventRegistration.setStudent(student);
eventRegistration.setAttended(userEventRegistration.getAttended());
eventRegistration.setSubmitDateTime(new Date());
eventRegistration.setAdditionalInfo(userEventRegistration.getAdditionalInfo());
eventRegistration.setNumberAttending(userEventRegistration.getNumberAttending());
eventRegistration.setArchiveDate(userEventRegistration.getArchiveDate());
**sessionFactory.getCurrentSession().save(eventRegistration);**
sessionFactory.getCurrentSession().getTransaction().commit();
休止状態のマッピング
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.myapps.issu.models.database.Event" table="events">
<id name="eventId" column="event_id" type="integer" />
<property name="eventName" column="event_name" type="string" />
<property name="eventType" column="event_type" type="string" />
<property name="descriptionBrief" column="description_brief" type="string" />
<property name="descriptionFull" column="description_full" type="string" />
<property name="location" column="location" type="string" />
<property name="cost" column="cost" type="string" />
<property name="compulsory" column="compulsory" type="string" />
<property name="comments" column="comments" type="string" />
<property name="maxAttendance" column="max_attendance" type="integer" />
<property name="askDietaryRestrictions" column="ask_dietary_restrictions" type="integer" />
<property name="limitPerStudent" column="limit_per_student" type="string" />
<list name="eventInstance" table="event_instances" inverse="false" cascade="all">
<key column="event_id" />
<list-index column="idx" />
<one-to-many class="com.myapps.issu.models.database.EventInstance" />
</list>
</class>
<class name="com.myapps.issu.models.database.Student" table="students">
<id name="studentId" column="student_id" type="string" />
<property name="familyName" column="family_name" type="string" />
<property name="givenName" column="given_name" type="string" />
<property name="fan" column="fan" type="string" />
<property name="gender" column="gender" type="string" />
<property name="email" column="email" type="string" />
<property name="homeCountry" column="home_country" type="string" />
<property name="course" column="course" type="string" />
<property name="accomodationName" column="accomodation_name" type="string" />
<property name="address" column="address" type="string" />
<property name="addressCity" column="address_city" type="string" />
<property name="contactPhone" column="contact_phone" type="string" />
<property name="contactDetailsStatus" column="contact_details_status" type="string" />
<property name="contactDetailsDate" column="contact_details_date" type="date" />
<property name="scholarships" column="scholarships" type="string" />
<property name="dietaryRestrictions" column="dietary_restrictions" type="string" />
<property name="studentComments" column="student_comments" type="string" />
<property name="internalComments" column="internal_comments" type="string" />
<list name="eventRegistration" table="event_registrations" inverse="false" cascade="all">
<key column="registration_id" />
<list-index column="idx" />
<one-to-many class="com.myapps.issu.models.database.EventRegistration" />
</list>
</class>
<class name="com.myapps.issu.models.database.EventInstance" table="event_instances">
<id name="instanceId" column="instance_id" type="integer" />
<many-to-one name="event" class="com.myapps.issu.models.database.Event" column="event_id" fetch="select" not-null="true" />
<property name="startDateTime" column="start_date_time" type="date" />
<property name="finishDateTime" column="finish_date_time" type="date" />
<property name="locationIfDifferent" column="location_if_different" type="string" />
<property name="registerCutoffDate" column="register_cutoff_date" type="date" />
<property name="maxAttendance" column="max_attendance" type="integer" />
<property name="askDietaryRestrictions" column="ask_dietary_restrictions" type="string" />
<property name="limitPerStudent" column="limit_per_student" type="integer" />
<property name="archiveDate" column="archive_date" type="date" />
<property name="rollcallProcessed" column="rollcall_processed" type="string" />
<property name="linkedInstance" column="linked_instance" type="integer" />
<list name="eventRegistration" table="event_registrations" inverse="false" cascade="all">
<key column="instance_id" />
<list-index column="idx" />
<one-to-many class="com.myapps.issu.models.database.EventInstance" />
</list>
</class>
<class name="com.myapps.issu.models.database.EventRegistration" table="event_registrations">
<id name="registrationId" column="registration_id" type="integer">
<generator class="sequence-identity" >
<param name="sequence">REGISTRATIONS_SEQ</param>
</generator>
</id>
<many-to-one name="eventInstance" class="com.myapps.issu.models.database.EventInstance" column="instance_id" not-null="true" />
<many-to-one name="student" class="com.myapps.issu.models.database.Student" column="student_id" not-null="true" />
<property name="attended" column="attended" type="string" />
<property name="submitDateTime" column="submit_date_time" type="date" />
<property name="additionalInfo" column="additional_info" type="string" />
<property name="numberAttending" column="number_attending" type="integer" />
<property name="archiveDate" column="archive_date" type="date" />
</class>
<class name="com.myapps.issu.models.database.Lov" table="Lov">
<id name="lovId" column="lov_id" type="integer" />
<property name="kind" column="kind" type="string" />
<property name="code" column="code" type="string" />
<property name="description" column="description" type="string" />
</class>
</hibernate-mapping>
エラーメッセージ
org.hibernate.AssertionFailure: getGeneratedKeys() support is not enabled
org.hibernate.engine.jdbc.internal.StatementPreparerImpl.checkAutoGeneratedKeysSupportEnabled(StatementPreparerImpl.java:93)
org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:112)
org.hibernate.id.SequenceIdentityGenerator$Delegate.prepare(SequenceIdentityGenerator.java:106)
org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:55)
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2936)
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3447)
org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:81)
org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:203)
org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:183)
org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:167)
org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:320)
org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:287)
org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:193)
org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:126)
org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:204)
org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:55)
org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:189)
org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:49)
org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:756)
org.hibernate.internal.SessionImpl.save(SessionImpl.java:748)
org.hibernate.internal.SessionImpl.save(SessionImpl.java:744)
au.edu.flinders.issu.dao.IssuDaoImpl.saveEventRegistration(IssuDaoImpl.java:64)
au.edu.flinders.issu.services.IssuServiceImpl.saveEventRegistration(IssuServiceImpl.java:24)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
$Proxy13.saveEventRegistration(Unknown Source)
au.edu.flinders.issu.controllers.IssuController.saveEventRegistration(IssuController.java:41)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:100)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:604)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:565)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)