최대 절전 모드를 사용 중입니다. 그리고 내 데이터베이스의 테이블에 새 행을 지속적으로 추가하려고합니다. 내 액션 클래스의 코드를 사용하고SEVERE : 'UID'ID 열 수정 시도
은 다음과 같습니다
try {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
u = new Users();
u.setAge(this.getAge());
u.setCity(this.getCity());
u.setEmail(this.getEmail());
u.setName(this.getUsername());
u.setPassword(this.getPassword());
u.setSex(this.getSex());
try {
session.save(u);
}
catch (Exception e) {
this.addActionError("Oops. An Error Encountered...! Email address already registered. Try with your new email address.");
return ERROR;
}
session.getTransaction().commit();
session.close();
} catch (Exception e) {
this.addActionError("Oops. An Error Encountered...!");
return ERROR;
}
페이지 때로는 외부 캐치 때로는 내부 캐치의 오류를 보여줍니다. 글래스 피시 서버 로그는 다음과 같습니다
WARNING: SQL Error: -1, SQLState: 42Z23
SEVERE: Attempt to modify an identity column 'UID'.
SEVERE: Could not synchronize database state with session
org.hibernate.exception.SQLGrammarException: could not insert: [beans.Users]
..
Caused by: java.sql.SQLSyntaxErrorException: Attempt to modify an identity column 'UID'.
내 표는 게터와 검색 위 그러나이가 아닌 다른 많은 분야가 있습니다 자동 생성 증가가 1입니다 '사용자'가진 기본 키 'UID'입니다 행의 생성과 함께 테이블 속성으로 주어진 기본 값, 그래서 그들에 게터와 세터를 적용하지 않기로 결정했다. 또한 나는 자동으로 생성되므로 'uid'에 getter 및 setter를 사용하지 않았습니다.
누군가가 오류가 될 수있는 점을 지적 할 수 있습니까? 사전에 감사합니다.
사용자 매핑 게시, 거기에 실수가 의심됩니다. – Firo