둘러보기 생략.
 

QueryService에서 쿼리문을 사용하지 않고 VO를 사용하여 create하는 경우 sql.Date 객체관련 문의

안녕하세요...

우선 anyframe 3.0.1버전을 사용중입니다.

1. DB의 컬럼 타입이 Date이고 VO에서 mapping되는 변수를 java.sql.Date객체를 사용하였습니다.
2. SQL문장을 사용하지 않고 queryservice에 VO객체를 넘겨서 create/update하는 메소드를 사용하였습니다.
3. 실제로 db에 insert된 컬럼의 값을 조회해 보면...
연/월/일 정보는 제대로 나오나, 시:분:초의 데이터가 모두 00:00:00 으로 들어갑니다.

Impl에서 구현한 코드는 다음과 같습니다.

java.sql.Date sqlDate = new java.sql.Date(java.util.Calendar.getInstance().getTimeInMillis());
vo.setRegDate(sqlDate);
SimpleDateFormat sf = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
System.out.println("sqlDate:"+sf.format(sqlDate));

위의 코드에서 system.out으로 찍어보면 sql.Date객체에는 시:분:초의 값이 정상적으로 들어 있습니다.

Re] QueryService에서 쿼리문을 사용하지 않고 VO를 사용하여 create하는 경우 sql.Date 객체

일반적으로 java.sql.Date는 일부 Timezone에 대해서 시,분,초를 0으로 셋팅합니다. 따라서, 입력하실때 시,분,초의 데이터를 입력하였다 하더라도 DB에는 입력되지 않게 됩니다.
따라서 시,분,초까지의 정확한 데이터를 얻고자 하시는 경우에는 java.sql.Timestamp 유형의 객체를 사용하시면 됩니다.
[참고] java.sql.Date API Document

DB컬럼이 Date인경우 VO의 변수를 Timestamp로 사용이 가능한가요?

답변 감사합니다.

anyframe매뉴얼에는 DB컬럼 타입이 Date인 경우에는 java.sql.Date를 사용하라고 되어 있어서
처음에 java.sql.Date객체를 사용하였습니다.

답변 주시는 동안 Timestamp객체로 변환하여 해결하였습니다.

anyframe core매뉴얼에 DATE컬럼 타입의 경우에 Timestamp객체도 사용이 가능하다는 부분이 추가되면
좋을 것 같습니다. ^^

Can I simply say what a aid

Can I simply say what a aid to search out somebody who truly knows what theyre talking about on the internet. You positively know learn how to convey a difficulty to light and make it important. Extra people have to read this and understand this aspect of the story. I cant imagine youre no more fashionable since you undoubtedly have the gift.
Youth ministry christmas games guardrail Money Management Wallaroo Voucher Codes sightlessly

Good post. I learn something

Good post. I learn something more challenging on totally different blogs everyday. It'll always be stimulating to read content from other writers and observe somewhat something from their store. I’d want to make use of some with the content material on my blog whether or not you don’t mind. Natually I’ll give you a link in your internet blog. Thanks for sharing.
male enhancement reviews haiku how to look younger percent letters from santa templates shovel