Announcement Announcement Module
No announcement yet.
WebApp with Spring Roo Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • WebApp with Spring Roo

    I am trying out Spring Roo to see if we can use it to migrate some of non-java apps.
    What I am doing now is creating a simple web application called auction that has the following features:

    Entities : User, Bid, Item


    1. Item has many bids [bidirectional]
    2. User has many bids [bidirectional]

    Use Cases:
    1. Create a New user [out of the box from Roo]
    2. Create a new item [out of the box from Roo]
    3. Create a new Bid [Should allow only when item and user both are available and selected]
    4. Standard finders

    UI restrictions:

    1. Login Page
    2. Roles: admin, user
    3. Admin can add items + super power !!
    4. User can add bids, see bids by other user, update only self placed bids

    What I have got so far is the standard generated UI, here is my script.

    persistence setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT
    entity --class ~.domain.Item --table ITEM --identifierField id --identifierType java.lang.Long --identifierColumn ID --testAutomatically
    entity --class ~.domain.Bid --table BID --identifierField id --identifierType java.lang.Long --identifierColumn ID --testAutomatically
    entity --class ~.domain.Bidder --table BIDDER --identifierField id --identifierType java.lang.Long --identifierColumn ID --testAutomatically
    field string --fieldName name --column NAME --notNull --class ~.domain.Item
    field string --fieldName name --column NAME --notNull --class ~.domain.Bidder
    field number --fieldName bidValue --type java.lang.Long --column BID_VALUE --notNull --class ~.domain.Bid
    field reference --class ~.domain.Bid --fieldName item --type ~.domain.Item --cardinality MANY_TO_ONE --joinColumnName ITEM_FK
    field reference --class ~.domain.Bid --fieldName bidder --type ~.domain.Bidder --cardinality MANY_TO_ONE --joinColumnName BIDDER_FK
    field set --class ~.domain.Item --element ~.domain.Bid --fieldName bids --cardinality ONE_TO_MANY --mappedBy item --notNull true
    field set --class ~.domain.Bidder --element ~.domain.Bid --fieldName bids --cardinality ONE_TO_MANY --mappedBy bidder --notNull true
    finder add findBidsByBidder --class ~.domain.Bid
    finder add findBidsByItem --class ~.domain.Bid
    controller all --package ~.domain.web

    1. What is the best possible way to achieve my requirements mentioned above by using Roo? I would like to see how far I can get without having to edit the files manually. May be I am missing on some documentation?

    2. Also, one thing I noticed is that the standard JPA CRUD methods are generated for each entity. Is there a way to have a common super class for all entities that can have a generic apsect with data access CRUD methods?