Back Forum Reply New

Frustrations with Spring, Roo and Master/Detail

Hi,

I don't know whether to be impressed or exasperated.  

I used Roo to generate 33 entities with about 250 total fields, and I was really impressed that it was able to generate forms for all my entities and actually update the database.   But of course, they are all stand-alone forms.

But now that I actually have to modify this output to produce something useful for an ordinary human data-entry employee to use.  I find myself completely lost.  Every problem in Spring seems to be solved by yet another level of indirection.   I can't find even one real-world example application or tutorial that shows how to implement a master-detail relationship.

lt;IGNORANT RANTgt;Back in 1996 I used to code in INFORMIX 4gl.  And the code for developing user input forms was very straightforward.  Master-detail was built in, as was the ability to quot;zoomquot; to another table to choose a value.

Why does this all have to be so complicated?  These are JUST FORMS!!!!

I find it ironic that it was easier to do forms with master-detail back in 1996
lt;/IGNORANT RANTgt;

Ok -- now that I've got that off my chest.   Can someone PLEASE show me how to implement master-detail, starting from the Roo-generated code?

Relationships in my applicationParty (person or organization)Addresses
Phone Numbers
OrdersOrderItemsAddress (delivery)
ItemSKU  (from our Catalog)Description
Price

QuantityBasically, I simply need the following kinds of functionality
1)  When a Party is selected, display links to find their Addresses, Phone numbers and Orders.

2)  While displaying the Party Name above, display a panel that allows one to list orders, and create new orders

3) When Adding an order Item, allow the user to show and search a list of catalog items. NOTE: A drop-down select box isn't going to work for a 10,000 element catalog

4) When Adding an order item, allow the user to select one of their existing addresses
as the delivery/shipping address, or enter a new address

Programmers have been doing stuff like this since the stone ages.  Why can't we do it easily in Roo and Spring?

Mark

Hello Mark,

One point from section 4.7 in Roo reference Doc...

quot;Following some simple recommendations will ensure you have the best possible experience with Roo:
Remember you'll still need to write Java code (and JSPs for custom controllers). Have the right expectations before you start using Roo. It just helps you - it doesn't replace the requirement to program.quot;

All technologies have limitations, I believe. BTW, I worked with Informix 4GL It was a good source of frustrations as well. As a Developer I'm grateful with Roo helping me out with a bunch of time consuming and tedious work that I don't have to do anymore.

Thank you
jD
showcases

From my experience with Roo, Roo doesn't design and implement the User Interface, it sets up your project in a accepted standard way so you don't have to worry about it.

It also, creates a quot;developer's user interfacequot;  basically a bunch of forms that allow you to mess with the data right off the bat without having to code it yourself.Don't know if this will help you out, but I tried to simulate your project using this roo script:

Code:
project --topLevelPackage com..helper

persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY

entity --class ~.domain.Address --testAutomatically
field string --fieldName address
field string --fieldName city
field string --fieldName stateAbbreviation
field string --fieldName zipCode

entity --class ~.domain.PhoneNumber --testAutomatically
field string --fieldName name
field string --fieldName phoneNumber

entity --class ~.domain.ItemSKU --testAutomatically
field string --fieldName description
field number --fieldName price --type java.lang.Double

entity --class ~.domain.OrderItem --testAutomatically
field reference --fieldName deliveryAddress --type ~.domain.Address
field reference --fieldName itemSKU --type ~.domain.ItemSKU
field number --fieldName quantity --type java.lang.Integer
entity --class ~.domain.PartyOrder --testAutomatically
field set --fieldName orderItems --type ~.domain.OrderItem

entity --class ~.domain.Party --testAutomatically
field set --fieldName addresses --type ~.domain.Address
field set --fieldName phoneNumbers --type ~.domain.PhoneNumber
field set --fieldName orders --type ~.domain.PartyOrdercontroller all --package ~.web

logging setup --level DEBUG
then I edited the partyorder/show.jspx, copying the tables from the list.jspx in the addresses, phonenumbers, and partyorders, added the xmlns:table to the top div:

Code:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot; standalone=quot;noquot;?gt;
lt;div xmlns:field=quot;urn:jsptagdir:/WEB-INF/tags/form/fieldsquot; xmlns:jsp=quot;JSP/Pagequot; xmlns:page=quot;urn:jsptagdir:/WEB-INF/tags/formquot; xmlns:table=quot;urn:jsptagdir:/WEB-INF/tags/form/fieldsquot; version=quot;2.0quot;gt;   lt;jsp:directive.page contentType=quot;text/html;charset=UTF-8quot;/gt;   lt;jsputput omit-xml-declaration=quot;yesquot;/gt;   lt;page:show id=quot;ps_com__helper_domain_Partyquot; object=quot;${party}quot; path=quot;/partysquot; z=quot;om9ETV0Bt7pQQyU4KIWjk36CmKg=quot;gt;   lt;page:list id=quot;pl_com__helper_domain_Addressquot; items=quot;${addresses}quot; z=quot5iAdJohekXa00xPhPS4+Fn4AgU=quot;gt;       lt;table:table data=quot;${addresses}quot; id=quot;l_com__helper_domain_Addressquot; path=quot;/addressesquot; z=quot;GZhkCvN5USXqT0UMJvez5PUfiO8=quot;gt;lt;table:column id=quot;c_com__helper_domain_Address_addressquot; property=quot;addressquot; z=quot;nNEz6U1hKsVhXlz9DSSpRlZHUeM=quot;/gt;lt;table:column id=quot;c_com__helper_domain_Address_cityquot; property=quot;cityquot; z=quot;rjnd/0kktTTVxK7YkolzmVPoBxE=quot;/gt;lt;table:column id=quot;c_com__helper_domain_Address_stateAbbreviationquot; property=quot;stateAbbreviationquot; z=quot;V/KFv47bRjLVVFeuS7OOSAX23x8=quot;/gt;lt;table:column id=quot;c_com__helper_domain_Address_zipCodequot; property=quot;zipCodequot; z=quot;zYs6MOMbkAnWFBlQGpT46EZM55U=quot;/gt;       lt;/table:tablegt;   lt;/page:listgt;   lt;page:list id=quot;pl_com__helper_domain_PhoneNumberquot; items=quot;${phonenumbers}quot; z=quot;tokp8Y4+eKNrVun8ugsB6HrYc1A=quot;gt;       lt;table:table data=quot;${phonenumbers}quot; id=quot;l_com__helper_domain_PhoneNumberquot; path=quot;/phonenumbersquot; z=quot;aZh3sII+GhUo2rxKBlilVWFuII0=quot;gt;lt;table:column id=quot;c_com__helper_domain_PhoneNumber_namequot; property=quot;namequot; z=quot;otQnfWcqFL2ktsZmYalYLsBt3Jk=quot;/gt;lt;table:column id=quot;c_com__helper_domain_PhoneNumber_phoneNumberquot; property=quot;phoneNumberquot; z=quot;e+KxfB8n6fKGGn6WoUAlu0G3oac=quot;/gt;       lt;/table:tablegt;   lt;/page:listgt;   lt;page:list id=quot;pl_com__helper_domain_PartyOrderquot; items=quot;${partyorders}quot; z=quot;xobDWWCrhGPO0ArEpRcNx1gqECU=quot;gt;       lt;table:table data=quot;${partyorders}quot; id=quot;l_com__helper_domain_PartyOrderquot; path=quot;/partyordersquot; z=quot;L93dWV8JLh0pWozh3rctiqLoaRY=quot;gt;lt;table:column id=quot;c_com__helper_domain_PartyOrder_orderItemsquot; property=quot;orderItemsquot; z=quot;iKfBTp5eCmBj64xrqd4wNmNS1CQ=quot;/gt;       lt;/table:tablegt;   lt;/page:listgt;   lt;/page:showgt;
lt;/divgt;
Now when a Party is selected for viewing, it shows all the addresses, orders, and phone numbers.  All I did was cut and paste the code Roo Generated and combined them into the same form.

Now of course the form isn't fully functional, adding a new address from this form won't link it to the selected party, that code would have to be written, same with the order and phone numbers, etc.
But hopefully it might help.

Of all the pieces that I see here, Roo is not the problem.  It works pretty much as advertised, with a few exceptions and bugs, and the interface is actually very simple and usable and the tutorials generally work.  Persistence, Entities, Fields, and Controllers and then it runs.

The problem is with THE OUTPUT.   And that's probably more of a Swing MVC problem.

The generated code is incomprehensible.  It's like looking at cuneiform without a dictionary.
I have what looks like a simple application generated, but its 33 separate, disjoint, table viewers.   And to make heads or tails of the code, I have to go through what feels like and endless series of indirections.  Nothing seems directly related to the output, it's all smoke and mirrors through tags,

All I want to do is hook the pieces together into an application that understands that customers have orders, orders have items chosen (zoom lookup) from a catalog.   It's the same basic kind of application pattern that's been built countless times.   I'd use something off the shelf, except I have about a dozen other less typical parent/child or master/detail relationships that I know I have to build myself.

Why is that so hard?  I managed to find two other threads asking the same question, but still no answer.  It must be nearly impossible to describe, otherwise there would be
a ready example to point me to or real world tutorial that does what must the most common use case in the world.   Master-Detail with Zoom Lookups.

Sorry for sounding off -- I'm sure this stuff feels wonderful once you know all the details and have suffered thru the learning curve.  Right now I'm tempted to write it all by hand so at least I understand the program.

Mark

lt;advance-apologygt;
Ok -- I'll probably feel like a moron for ranting like this after I manage to fit all these pieces together.  But right now, I need a solution so I can get my project rolling.  
lt;/advance-apologygt;

That looks helpful for displaying the pieces together.   But I need to be able to edit everything at each level.  Basically, the application needs to limit it's scope :

1) while we have a party selected, all edits to addresses, phone number and orders refer only to that party.

2) when we select or create an order, it's naturally from that party, since all others have been excluded.

3) while the order is selected, any items added or updated belong only to that order

4) while adding items to the order for the party, we can zoom out to search a catalog of potential items
filtered by appropriateness for the given customer and order.

The application will have several of these multi-level master-detail-evenMoreDetail entry points.

If I can figure out how to do this once -- I'll be able to code my entire application.
¥
Back Forum Reply New