왜 제네릭이 안되었는지 이제 알았다. 확실히...
먼저 제네릭이 안되었을때의 하이버네이트와 매핑한 bean을 살펴보면
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Integer getUserSeq() {
return userSeq;
}
오류난 로그
2010-01-09 23:06 [DEBUG] opened session at timestamp: 12630460153
2010-01-09 23:06 [DEBUG] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2010-01-09 23:06 [DEBUG] opening JDBC connection
2010-01-09 23:06 [DEBUG] select this_.userSeq as userSeq2_0_, this_.ANSWER as ANSWER2_0_, this_.BIRTH_DAY as BIRTH3_2_0_, this_.CREATE_DATE as CREATE4_2_0_, this_.DISABLE as DISABLE2_0_, this_.DOMAIN as DOMAIN2_0_, this_.E_MAIL as E7_2_0_, this_.EMAIL_DENY as EMAIL8_2_0_, this_.masterCodes as masterCo9_2_0_, this_.QUESTION as QUESTION2_0_, this_.RELATION_GROUP_SEQ as RELATION11_2_0_, this_.RELATION_SEQ as RELATION12_2_0_, this_.UPDATE_DATE as UPDATE13_2_0_, this_.USER_ID as USER14_2_0_, this_.USER_NAME as USER15_2_0_, this_.USER_NICK as USER16_2_0_, this_.USER_PW as USER17_2_0_, this_.USER_STATUS as USER18_2_0_ from MEMBER this_ where this_.USER_ID=? and this_.USER_PW=?
2010-01-09 23:06 [DEBUG] preparing statement
2010-01-09 23:06 [DEBUG] binding 'agnes0417' to parameter: 1
2010-01-09 23:06 [DEBUG] binding '~~~~~~~' to parameter: 2
2010-01-09 23:06 [DEBUG] about to open ResultSet (open ResultSets: 0, globally: 0)
2010-01-09 23:06 [DEBUG] processing result set
2010-01-09 23:06 [DEBUG] result set row: 0
2010-01-09 23:06 [DEBUG] returning null as column: userSeq2_0_
-> primary key 가 null인게 있을리 없다..
2010-01-09 23:06 [DEBUG] result row: null
2010-01-09 23:06 [DEBUG] done processing result set (1 rows)
2010-01-09 23:06 [DEBUG] about to close ResultSet (open ResultSets: 1, globally: 1)
2010-01-09 23:06 [DEBUG] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2010-01-09 23:06 [DEBUG] closing statement
@Column을 명시하지 않았기에 하이버네이트가 매핑된 이름 그대로 컬럼을 찾는다.
DB의 컬럼명은 USER_SEQ인데.. 만약 DB 컬럼명이 USERSEQ였다면 제네릭이 되었을테지만..
아래처럼 고쳐주었다..
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="USER_SEQ")
public Integer getUserSeq() {
return userSeq;
}
제대로 돌아간 로그 기록..
2010-01-09 23:01 [DEBUG] opened session at timestamp: 12630457058
2010-01-09 23:01 [DEBUG] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2010-01-09 23:01 [DEBUG] opening JDBC connection
2010-01-09 23:01 [DEBUG] select this_.USER_SEQ as USER1_2_0_, this_.ANSWER as ANSWER2_0_, this_.BIRTH_DAY as BIRTH3_2_0_, this_.CREATE_DATE as CREATE4_2_0_, this_.DISABLE as DISABLE2_0_, this_.DOMAIN as DOMAIN2_0_, this_.E_MAIL as E7_2_0_, this_.EMAIL_DENY as EMAIL8_2_0_, this_.masterCodes as masterCo9_2_0_, this_.QUESTION as QUESTION2_0_, this_.RELATION_GROUP_SEQ as RELATION11_2_0_, this_.RELATION_SEQ as RELATION12_2_0_, this_.UPDATE_DATE as UPDATE13_2_0_, this_.USER_ID as USER14_2_0_, this_.USER_NAME as USER15_2_0_, this_.USER_NICK as USER16_2_0_, this_.USER_PW as USER17_2_0_, this_.USER_STATUS as USER18_2_0_ from MEMBER this_ where this_.USER_ID=? and this_.USER_PW=?
2010-01-09 23:01 [DEBUG] preparing statement
2010-01-09 23:01 [DEBUG] binding 'agnes0417' to parameter: 1
2010-01-09 23:01 [DEBUG] binding '~~~~~' to parameter: 2
2010-01-09 23:01 [DEBUG] about to open ResultSet (open ResultSets: 0, globally: 0)
2010-01-09 23:01 [DEBUG] processing result set
2010-01-09 23:01 [DEBUG] result set row: 0
2010-01-09 23:01 [DEBUG] returning '2' as column: USER1_2_0_
2010-01-09 23:01 [DEBUG] result row: EntityKey[com.jaeyeollee.model.join.Member#2]
2010-01-09 23:01 [DEBUG] Initializing object from ResultSet: [com.jaeyeollee.model.join.Member#2]
2010-01-09 23:01 [DEBUG] Hydrating entity: [com.jaeyeollee.model.join.Member#2]
2010-01-09 23:01 [DEBUG] returning null as column: DISABLE2_0_
2010-01-09 23:01 [DEBUG] returning '@naver.com' as column: DOMAIN2_0_
2010-01-09 23:01 [DEBUG] returning 'leepcs' as column: E7_2_0_
2010-01-09 23:01 [DEBUG] returning null as column: EMAIL8_2_0_
2010-01-09 23:01 [DEBUG] returning null as column: masterCo9_2_0_
2010-01-09 23:01 [DEBUG] returning '어머니 성함' as column: QUESTION2_0_
2010-01-09 23:01 [DEBUG] returning 'CG0000' as column: RELATION11_2_0_
2010-01-09 23:01 [DEBUG] returning 'CS0000' as column: RELATION12_2_0_
2010-01-09 23:01 [DEBUG] returning null as column: UPDATE13_2_0_
2010-01-09 23:01 [DEBUG] returning 'agnes0417' as column: USER14_2_0_
2010-01-09 23:01 [DEBUG] returning 'Hibernate' as column: USER16_2_0_
2010-01-09 23:01 [DEBUG] returning null as column: USER18_2_0_
2010-01-09 23:01 [DEBUG] done processing result set (1 rows)
2010-01-09 23:01 [DEBUG] about to close ResultSet (open ResultSets: 1, globally: 1)
2010-01-09 23:01 [DEBUG] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2010-01-09 23:01 [DEBUG] closing statement
그러니.. 제네릭이 된다.. 하하하;;;
아.. 볍신 인증했네...
'백엔드 > Hibernate' 카테고리의 다른 글
Found: timestamp, expected: date or Found: date, expected: timestamp 에러 (0) | 2012.11.30 |
---|---|
Criteria 사용할때 주의할 점. (0) | 2010.01.06 |