최대 절전 모드에서 새로운 기능입니다. 데이터베이스에서 Friend_Job 개체를 저장하려고 할 때 예외가 발생합니다.최대 절전 모드 : - JDBC 일괄 업데이트를 실행할 수 없습니다.
데이터베이스에서 Friend 및 Job 개체를 가져오고 새 Frien_Job 개체를 만듭니다.
Test.java
SessionFactory sessionFectory = new Configuration().configure().buildSessionFactory();
Session session = sessionFectory.openSession();
Transaction transaction = session.beginTransaction();
Friend friend= (Friend) session.load(Friend.class, new Integer(1));
Job job = (Job) session.load(Job.class, new Integer(3));
Friend_Job friend_Job = new Friend_Job();
friend_Job.setFriend(friend);
friend_Job.setJob(job);
friend_Job.setCompanyName(job.getCompanyName());
session.save(friend_Job);
transaction.commit(); //Exception here
Friend_Job.hbm.xml
<hibernate-mapping>
<class name="hibernateTest.Friend_Job" table="FRIEND_JOB">
<id name="primaryKey" column="PRIMARY_KEY">
<generator class="increment"/>
</id>
<property name="companyName" type="string" column="COMPANY_NAME"/>
<property name="salary" column="SALARY"/>
<many-to-one name="friend" class="hibernateTest.Friend" cascade="none" column="FK_FRIEND_ID"/>
<many-to-one name="job" class="hibernateTest.Job" cascade="none" column="FK_JOB_ID"/>
</class>
</hibernate-mapping>
예외 : - : java.sql.BatchUpdateException : ORA-00932 : 일관성에 의한
org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
at hibernateTest.Test.main(Test.java:20)
데이터 유형 : BINARY의 예상 숫자는 NUMBER입니다.
,210Friend_Job.java
다른public class Friend_Job {
private int primaryKey;
private String companyName;
private int salary = 0;
private Friend friend;
private Job job;
과 세터와 게터 있습니다.
더 많은 정보가 필요하면 알려주십시오 .... 미리 감사드립니다.
를 만들어 내가 극복 null 값을 보여주는 생성한다? – Firo
@Firo : - 열 유형 바이너리가 없으므로이 예외가 throw되는 이유를 알 수 없습니다. –