Hello, I'm sure this problem comes down to me not fully groking the JPA way: Using OpenJPA (2.0.1), how do I get a call to persist() to automatically populate non-nullable, non-key fields whose values are generated by the database? Here are the particulars:
DDL: modified timestamp not null default current_timestamp, Entity: @Temporal (TemporalType.TIMESTAMP) @Column (insertable=false, updatable=false) private Calendar modified; Relevant JPA Property: openjpa.AutoDetach=close,commit,nontx-read Databases: PostgreSQL 8.4, Derby 10.8 Test (which fails): ...{set fields, but not 'modified'}... et = em.getTransaction(); et.begin(); em.persist(entity); et.commit(); assertNotNull(entity.getModified()); A query on the table, of course, shows a value for modified. Some things I've tried that haven't worked: * Immediately after persist, entity.getModified(); * Immediately after persist, em.refresh(entity); On a possibly related note, I'm puzzled as to why I'm seeing the following message when I run my tests despite the fact that I'm running the enhancer on my domain classes via the openjpa-maven-plugin (codehaus): INFO [main] openjpa.Enhance - You have enabled runtime enhancement, but have not specified the set of persistent classes. ... I've inspected the .class file and it has a pcGetmodified among other things. So it looks like the classes are indeed getting enhanced. Any insights? Do I need a post processor to populate 'modified'?