JPA notes
I really like the JPA spec & Hibernate’s implementation of it. It’s been easy to work with and fairly intuitive. I ran into two things today that were worth commenting on though.
- It’s worth your effort in being consistent in how you update the Database Schema; If you use scripts, do it always, if you use the JPA provider, do it always. I use the hibernate envers plugin and really like it, but if you do updates through your DB console or w/ scripts and forget about the *_revisions table, you can get weird type conversion or size problems that are unclear. During my dev cycle, I like dropping the schema and recreating it from scratch to ensure everything is right. You can even generate your production script from that when dif’d w/ previous production DB script…
- The length attribute on a @Column annotation where the type is a String always generates a VARCHAR(mylength) database column. If you want a TEXT or CLOB field, you need to use the @Lob annotation & then the length attribute is irrelevant.
As usual, it seems obvious in retrospect, but was weird when dealing w/ the errors.
-
Archives
- September 2011 (1)
- August 2011 (1)
- February 2009 (1)
- June 2008 (1)
- March 2008 (1)
- December 2007 (1)
- September 2007 (1)
- July 2007 (3)
- January 2007 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS