ドメインに2つのフィールドClassContentSequenceを追加します:lastUpdated、dateCreated、これはGORMによって自動的に更新されます。
アプリケーションを再度実行した後、レコードを取得しようとします:
ContentSequence.get(1);
残念ながら、Webインターフェイスのコンソールで次のように表示されます:org.springframework.dao.TransientDataAccessResourceException:Hibernate操作:可能性があります not load an entity: [com.abdennour.content.ContentSequence#200]; SQL [select contentseq0_.id as id17_0_, contentseq0_.version as version17_0_, contentseq0_.chapter_id as chapter3_17_0_, contentseq0_.date_created as date4_17_0_, contentseq0_.difficulty as difficulty17_0_, contentseq0_.last_updated as last6_17_0_, contentseq0_.level_id as level7_17_0_, contentseq0_.name as name17_0_, contentseq0_.other as other17_0_, contentseq0_.owner_id as owner10_17_0_, contentseq0_.subject_id as subject11_17_0_, contentseq0_.type as type17_0_ from content_sequence contentseq0_ where contentseq0_.id=?]; Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
そしてターミナルで、私は得る:
util.JDBCExceptionReporter Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
タイムスタンプには最小値があるため、SQLを手動でクエリして日付フィールドの値を更新します
UPDATE content_sequence
SET date_created = '2013-08-08 00:00:00';
UPDATE content_sequence
SET last_updated = '2013-08-08 00:00:00';
そして今、それは仕事です。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加