Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Creating schema from entities

  1. #11
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    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.

    -Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  2. #12
    Join Date
    Feb 2008
    Posts
    169

    Default

    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.

  3. #13
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    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).
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  4. #14
    Join Date
    Feb 2008
    Posts
    169

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •