최대 절전 모드를 사용하여 데이터베이스와 상호 작용합니다. 삽입, 삭제, 업데이트 작업은 커밋 문 session.getTransaction.commit()에 의해 종료되므로 아무런 문제가 없습니다.최대 절전 모드로 데이터 읽기가 데이터베이스와 동기화되지 않습니다.
그러나 최대 절전 모드는 이전에 표시된 데이터를 반환하고 모든 새 레코드 또는 변경된 업데이트는 표시되지 않습니다.
그래서이 질문을하기 전에 비슷한 질문으로 이동해 보았지만 (2 주 전) 모든 권장 사항을 적용하는 동안 답을 찾지 못했습니다. 이것은 나를 위해 이상한되었다
내가 최근에 삽입 된 레코드를 업데이트 할 때 나는 다음을 얻을 수 있기 때문에 두 번째 레벨 캐시의 (b) 분리 레벨을 증가 활성화
(A).
HTTP Status 500 - No row with the given identifier exists: [com.bd.model.TestType#15] type Exception report message No row with the given identifier exists: [com.bd.model.TestType#15] description The server encountered an internal error that prevented it from fulfilling this request. exception org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.bd.model.TestType#15] org.hibernate.impl.SessionFactoryImpl$1.handleEntityNotFound(SessionFactoryImpl.java:377) org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:79) org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:68) org.hibernate.Hibernate.initialize(Hibernate.java:306) com.bnr.clinic.services.TestTypeServices.getTestTypeById(TestTypeServices.java:79) com.bnr.clinic.controller.TestTypeUpdateController.doPost(TestTypeUpdateController.java:85) javax.servlet.http.HttpServlet.service(HttpServlet.java:646) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.52 logs.
여기 제가 사용하는 선택 방법이 있습니다!
그래서 나는 두 가지 질문 물어 기쁘게 생각합니다 :<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- Database connectivity --> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/mis</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">@ict#</property> <property name="connection.pool_size">1</property> <!-- Enable Hibernate's automatic session context management --> <property name="current_session_context_class">thread</property> <property name="connection.autocommit">true</property> <!-- Disabling timeout --> <property name="connection.autoReconnect"> true</property> <property name="connection.autoReconnectForPools">true</property> <property name="c3p0.min_size">5</property> <property name="c3p0.max_size">20</property> <property name="c3p0.timeout">1800</property> <property name="c3p0.max_statements">50</property> <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> <property name="connection.release_mode">auto</property> <!-- Disable the second-level cache --> <property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property> <property name="hibernate.cache.use_second_level_cache">false</property> <property name="hibernate.cache.use_query_cache">true</property> <property name="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</property> <!-- Echo all executed SQL to stdout --> <property name="show_sql">true</property> <property name="hbm2ddl.auto">update</property> <mapping class="com.bd.model.Test" /> <mapping class="com.bd.model.TestType" /> </session-factory> </hibernate-configuration>
public TestType getTestTypeById(int idTestType) { session = sf.getCurrentSession(); session.beginTransaction(); session.clear(); TestType testTypes = (TestType) session.load(TestType.class, idTestType); Hibernate.initialize(testTypes); return testTypes; }
내 최대 절전 모드 설정 파일이 내 방법으로 잘못 어떤 일이 아니면와 내가 잘못
을 내 최대 절전 모드 구성?
hibernate가 새로운 삽입 된 레코드를 얻기 위해 데이터베이스와 동기화하는 것을 방지하고있는 것은 무엇입니까?
감사합니다.