Feb 3rd, 2010, 05:00 PM
I think one of the main issues here is that you are mixing JPA identifiers with business logic. I think you should consider decoupling your database identifier from your series field. This way you can make the series field a unique but independent business key and apply all the constraints you need. Don't forget, Roo does not require this but rather this is a limitation of the JPA API to a degree. All Roo does is to make use of the JPA standard to handle persistence matters.
Feb 3rd, 2010, 05:24 PM
I'm just trying to implement what Spring Security mandates for the schema. The main issue here is roo doesn't allow for non-auto incrementing Ids, right? JPA doesn't support this? What's the point of specifying the identifierType as anything but Integer or Long?
Also, just as a feature request, would be really great to be able to specify unique constraints in roo.
Feb 7th, 2010, 05:05 PM
Are you trying to write your own UserDetailsService or just use the JDBC directly? My advice would be to implement UserDetailsService and then have your implementation delegate to a Roo-created User entity and a Roo-created Group and/or Role entity. That way you can follow JPA conventions. The Spring Security default JDBC schema takes a minimalist approach as that's what is sure to be in most databases. It isn't optimised for creating a new database, though, as in that case you'll probably want to use JPA to create the DB schema and interact with the data (just a bit easier than raw JDBC, unless you have specific requirements that make JDBC a better choice).
Feb 7th, 2010, 05:28 PM
Hi Ben, I want to use Spring Security's JDBC mechanism even if it is minimalist. I don't have the time or desire to make sure I don't cause any security issues by trying to implement that functionality myself.
As a feature request, I'd like to maybe see a jpa-data-source-ref attribute for the remember-me element which uses a schema more conducive to JPA.
In the meantime I'll just bypass JPA/Hibernate and go direct JDBC whenever I need to interact with the remember-me data.