Beware of long Strings
Beware of long Strings
- Subject: Beware of long Strings
- From: Markus Ruggiero <email@hidden>
- Date: Mon, 03 Oct 2011 17:34:17 +0200
Folks,
I had a very troubling experience. Just wanted to know if I am seeing ghosts.
Very simple standard to-one relationship. Many entity is Product, one entity is Status. Relationship is modeled via numeric attribute statusId. The one-entity has a plain attribute with following settings:
Name: statusText
External Type: varchar2 (this is Oracle)
External Width: 1000
Class: java.lang.String
Data Type: String String s
I know this is a large String but none of the entries currently has more than about 100 chars.
Using this in ERD2W Application:
pageConfiguration="EditProduct" and propertyKey="status" => componentName="ERD2WEditToOneRelationship"
pageConfiguration="EditProduct" and propertyKey="status" => keyWhenRelationship="statusText"
When the app runs there is a nice popup with a list of all available status texts. Selecting one and pressing [SAVE] generates update SQL statement that sets the statusId on the product to NULL! What? NULL? Why? Editing a product that has a value set for statusId properly displays the related status text in the EditToOne popup. Doing nothing but pressing [SAVE] updates the product and sets statusId to NULL!!!
Comparing this toOne relationship with others in the same product entity reveals nothing. Pulling my hair, letting it lie there for a couple of days, deleting the relationship completely, rebuilding the project, re-establishing the relationship, renaming the relationship - nothing helps. Displayed OK but upon save set to NULL. Reconnecting manually by direct SQL manipulation results in proper display again - and reset to NULL upon save.
UNTIL... I erroneously remove the second rule from the rule file (the one with keyWhenRelationship). All of a sudden everything works as expected, it is just that the displayed string in the popup looks ugly (which is normal). Could it be...? Ok, defined public String userPresentableDescription() in Status entity returning the statusText() and no more hair pulling.
It works and I know why, but I do not know why it did not work before. Any ideas?
Have fun (yes, it was some sort of fun, anyway, as I have both sadistic and masochistic traits in my character [no, not 1000 of them], can someone call the guy with the big syringe, please?)
---markus---
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden