Announcement Announcement Module
No announcement yet.
Past sample models ... Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Past sample models ...

    Good afternoon,

    I am new to Roo. I carefully studied the PizzaShop sample application, and am quite impressed by the completeness of aspects you get using Roo from scratch to working web application.

    However I desperately looked everywhere to find how to perform basic operations on created entities.

    Take, for example, the sample PizzaShop application created by typing in :

    persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
    entity --class ~.domain.Topping --testAutomatically
    field string --fieldName name --notNull --sizeMin 2
    entity --class ~.domain.Base --testAutomatically
    field string --fieldName name --notNull --sizeMin 2
    entity --class ~.domain.Pizza --testAutomatically
    field string --fieldName name --notNull --sizeMin 2
    field number --fieldName price --type java.lang.Float
    field set --fieldName toppings --type ~.domain.Topping
    field reference --fieldName base --type ~.domain.Base
    entity --class ~.domain.PizzaOrder --testAutomatically
    field string --fieldName name --notNull --sizeMin 2
    field string --fieldName address --sizeMax 30
    field number --fieldName total --type java.lang.Float
    field date --fieldName deliveryDate --type java.util.Date
    field set --fieldName pizzas --type ~.domain.Pizza
    vaadin setup --applicationPackage ~.web --baseName PizzaShop --themeName pizza --applicationNameHtml Pizza<span>Shop</span> --useJpaContainer false
    vaadin generate all --package ~.web.ui
    (please ignore use of Vaadin here, which does not relate to my problem)

    This leads me to a perfectly functional web application, in which I can create bases, toppings, pizzas and pizza orders.

    Now let us suppose that I want the application to calculate the pizza order total price; this would (conceptually) be done by adding the prices of pizzas present in the pizza order.

    I may be completely stupid, but I just can't figure out how to do that : should I add a method in my entity code ? In such a case, how and when should I call it to compute the total price ? how can I add the total price field to PizzaOrder with automatic calculation ?

    I know these questions might sound really stupid, but between complete starter guides and advanced user configuration questions relating to Hibernate, JPA, Vaadin, etc. I could not find anything regarding "basic" operations (other examples include auto-naming the pizza by concatenating the chosen base and toppings instead of having the user choose a name for it ...)

    Thanks in advance

  • #2
    Is this question so stupid that nobody can bother to answer it ?