Hi,
I have a client-side ArrayCollection being filled with a DataService.fill(...) method. When I make a change to something in this collection and commit, everything works fine. If I add an item to the database that matches the fill, it shows up in the list just as it should. However if I try to make a change to this newly added item, I get the below error.
I have turned up the server-side logging and I can see the problem but I can’t get into the code to find the source of the problem. When I make a change to an object that was in the original fill, the log shows something like this:
[LCDS]Before document.updateItem (
(com.edgerd.common.data.Document) {id=6} (1111630848) {
tags = [{id=1} (1618503964), {id=2} (20766399)] (class: java.util.HashSet)
documentDate = Thu Jan 28 14:08:22 PST 2010
createTime = Thu Jan 28 14:08:22 PST 2010
workspace = {id=2} (911719589)
documentsForDocumentId = [] (class: java.util.HashSet)
browserHistories = [] (class: java.util.HashSet)
payload = [B@457a32c0
browserBookmarks = [] (class: java.util.HashSet)
meta = <meta>
<title>From hotmail to gmail</title>
</meta>
contacts = [] (class: java.util.HashSet)
content = {id=7} (1487879605)
id = 6
indexText = null
category = {id=3} (786813248)
hidden = false
previewText = null
user = {id=4} (1566520675)
documentEmailCredential = null
documentsForAttachmentId = [] (class: java.util.HashSet)
},
And everything works fine. However, when I make a change to the newly added item the log shows something like this:
[LCDS]Before document.updateItem (
(com.edgerd.common.data.Document) {id=18} (60472470) {
tags = [{id=4} (412657149)] (class: java.util.HashSet)
documentDate = Thu Jan 28 17:47:23 PST 2010
createTime = Thu Jan 28 17:47:23 PST 2010
workspace = null
documentsForDocumentId = [] (class: java.util.HashSet)
browserHistories = [] (class: java.util.HashSet)
payload = [B@16d1dcae
browserBookmarks = [] (class: java.util.HashSet)
meta = <meta>
<title>From gmail to hotmail</title>
</meta>
contacts = [] (class: java.util.HashSet)
content = null
id = 18
indexText = null
category = null
hidden = false
previewText = null
user = null
documentEmailCredential = null
documentsForAttachmentId = [] (class: java.util.HashSet)
},
It can be seen that some fields are now null which had values before. When the refreshFill is run on the server I can see from the log that the new object passed back to the client has all the properties which are null filled in with their IDs (as per the lazy loading rules I have configured). I have also debugged the client to be sure that these fields are properly filled in before the change is committed to the server and they are. My inclination is that when the flex.data.messages.DataMessage is created somehow the lazy properties are set to null in the case of the newly added object. Here is the error I’m getting:
[LCDS]Exception executing assembler operation. incomingMessage: Flex Message (flex.data.messages.DataMessage)
operation = update
id = ASObject(2034427172){id=18}
clientId = 61818E4D-7985-8B63-5470-77BC365C3DF1
correlationId = C4B6C894-E4E0-1412-DA94-77C2F655288E
destination = document
messageId = 7B5C1532-2B2C-8D60-80ED-77C2F655D457
timestamp = 1264729650778
timeToLive = 0
body =
[
[
tags
],
[Proxy(inst=com.edgerd.common.data.Document@3b36b0f1) proxyClass=class flex.messaging.io.BeanProxy descriptor=[ excludes: [browserBookmarks, browserHistories, category, contacts, content, documentsForAttachmentId, documentsForDocumentId, tags, user, workspace]]],
[Proxy(inst=com.edgerd.common.data.Document@39abc96) proxyClass=class flex.messaging.io.BeanProxy descriptor=[ excludes: [browserBookmarks, browserHistories, category, contacts, content, documentsForAttachmentId, documentsForDocumentId, tags, user, workspace]]]
]
hdr(prevReferencedIds) = {content=null, tags=null, category=null, workspace=null, documentsForDocumentId=null, browserHistories=null, browserBookmarks=null, user=null, documentEmailCredential=null, _LT::={}, contacts=null, documentsForAttachmentId=null}
hdr(DSId) = EA528CD8-1418-C7EE-CF24-A93D6EF31AA9
hdr(newReferencedIds) = {tags=
[
{id=4}
], content=null, category=null, workspace=null, documentsForDocumentId=null, browserHistories=null, browserBookmarks=null, user=null, documentEmailCredential=null, _LT::={}, contacts=null, documentsForAttachmentId=null}
hdr(DSEndpoint) = my-rtmp
exception: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.edgerd.common.data.Document.category
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:270)
There is obviously more stack trace too. I can get around this issue by running a refreshCollection(...) client-side on the ArrayCollection that holds the objects before committing but this doesn’t scale well at all. I’m hoping for a better solution.
Thanks for any help you can give me and let me know if more information is needed.
Mike
Views
Replies
Total Likes
> as per the lazy loading rules I have configured
Can you post your data-management-config.xml?
Views
Replies
Total Likes
> If I add an item to the database that matches the fill, it shows up in the list just as it should. However if I try to make a change to this newly added item, I get the below error.
This newly created item has to be "registered" with lcds to be managed. *May* want to try service.getItem(itemId)
Views
Replies
Total Likes