[flexcoders] Re: parent-child hierarchy of data using Flex, FDS and Hibernate
PW, I did the work to understand log4j and you're right, it is amazingly powerful. I added a new appender to my configuration in log4j.xml because all the literature I found said that the .properties approach was being deprecated. However, this has not worked, so I'm going to try your method from the other post. This should work... --- In flexcoders@yahoogroups.com, "parkerwhirlow" <[EMAIL PROTECTED]> wrote: > > > > All-in-all a very worthwhile exercise and my dev environment is now > > more under my control. > > Good to hear. was just replying to your previous post in this thread, > and now I see you got it figured out. Excellent. > > > > > I still can't figure out how to turn on debug logging in Hibernate, > > See this other post where I figured out how to turn on the Hibernate > logging. If you don't know about log4j, I suggest doing a few searches > on it, and reading up about the log4j.properties file. It's a very > powerful tool, and Hibernate has a TON of good logging, but its easy > to get lost in it all if you just turn everything on to debug... > > http://tech.groups.yahoo.com/group/flexcoders/message/59623 > > Hibernate has a sample log4j.properties in the Hibernate/etc directory > > > > > The exception is thrown way down in the bowels of the Hibernate > > session.save() method which is being called by > > HibernateAssembler.createItem. From Jeff's last post he seemed to be > > suggesting that updateItem was in some way at fault. I'm not quite > > seeing how that relates to my problem, although I am clearly no expert. > > > > I'm not exactly sure how the problem would occur from createItem(), > but take a look at my post here I mention what was causing it for me > (was a lazy=false setting on the collection association of the object > being updated) > > http://tech.groups.yahoo.com/group/flexcoders/message/63471 > > The issue with the NOT NULL column was that once I had everything > "working" the behavior it was doing was to null out all the FK values > for the association, thereby dis-associating the children from the > parent, then updating all the entries in the collection to point back > to the parent. Once I made the association nullable, the update > started working. (at least as far as FDS was concerned. > > > > > > Jeff, if you have a new version of the Assembler code and want a > > guinea-pig, send it my way. > > > > Likewise! > > cheers, > PW >
[flexcoders] Re: parent-child hierarchy of data using Flex, FDS and Hibernate
--- In flexcoders@yahoogroups.com, "Jeff Vroom" <[EMAIL PROTECTED]> wrote: > It is now trying > to do conflict detection on its own by comparing the previous version > with a version of the hibernate object it loads into that session. That > won't be transactionally correct unless you are using a strict isolation > level and Hibernate has its own versioning stuff which we should be > using instead. Just an FYI, I have turned off all UPDATE conflict detection in FDS (NONE) in an attempt to get the "simple case" working. I am fine with using Hibernate's versioning for conflict detection. PW
[flexcoders] Re: parent-child hierarchy of data using Flex, FDS and Hibernate
> All-in-all a very worthwhile exercise and my dev environment is now > more under my control. Good to hear. was just replying to your previous post in this thread, and now I see you got it figured out. Excellent. > > I still can't figure out how to turn on debug logging in Hibernate, See this other post where I figured out how to turn on the Hibernate logging. If you don't know about log4j, I suggest doing a few searches on it, and reading up about the log4j.properties file. It's a very powerful tool, and Hibernate has a TON of good logging, but its easy to get lost in it all if you just turn everything on to debug... http://tech.groups.yahoo.com/group/flexcoders/message/59623 Hibernate has a sample log4j.properties in the Hibernate/etc directory > The exception is thrown way down in the bowels of the Hibernate > session.save() method which is being called by > HibernateAssembler.createItem. From Jeff's last post he seemed to be > suggesting that updateItem was in some way at fault. I'm not quite > seeing how that relates to my problem, although I am clearly no expert. > I'm not exactly sure how the problem would occur from createItem(), but take a look at my post here I mention what was causing it for me (was a lazy=false setting on the collection association of the object being updated) http://tech.groups.yahoo.com/group/flexcoders/message/63471 The issue with the NOT NULL column was that once I had everything "working" the behavior it was doing was to null out all the FK values for the association, thereby dis-associating the children from the parent, then updating all the entries in the collection to point back to the parent. Once I made the association nullable, the update started working. (at least as far as FDS was concerned. > > Jeff, if you have a new version of the Assembler code and want a > guinea-pig, send it my way. > Likewise! cheers, PW
[flexcoders] Re: parent-child hierarchy of data using Flex, FDS and Hibernate
Hi guys, I have made a post in similar vein to this one, and had a couple comments. I agree that when possible, using managed associations and individual destinations for each side of the association is a best approach. However I'm running into issues with the "hierarchical values" approach you mention below. Maybe it's just my hibernate mappings, or maybe there's an issue. Note, I end up having to use this approach in some cases (destination references a base-class, and collection associations reside in sub-class instances). In the example used here, whenever I modify a value of a child (User Scenario) or grandchild (Scenario), because the save is going through the parent (PlanPoint), the Hibernate Assembler assigns the collection as though it were a property of the parent. At this point when the commit occurs, I get a "org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session" Check out my post. (http://tech.groups.yahoo.com/group/flexcoders/message/63308) I'd be interested to know if you get this working (hierarchical values), could you post up an example of the hibernate mappings? thanks, PW --- In flexcoders@yahoogroups.com, "Jeff Vroom" <[EMAIL PROTECTED]> wrote: > > This relates to your other question about the association tags in the > section. There are two ways you can work with non-primitive > object properties using FDMS. You can either have them be "managed > associations" or you can treat them as "hierarchical values". If you > choose the former, you define a destination for each data type and > explicitly define the relationships using the tags: > one-to-many, one-to-one, etc (FDMS only pays attention to the ...-to-one > or -to-many suffix as it only cares about whether the association is > single or multi-valued). In this approach, each destination deals with > the changes made to objects of that type. If you create a new child > object and add it to a property on the parent for example, it will send > the create event to the child destination and then send an update event > to the parent destination. These are both executed in the same > transaction so they will both get committed at the same time. > > > > When you use the hierarchical values approach, the entire object graph > underneath that property is treated as a single value. Any changes made > to any state under that property is treated as a change to the > property's value. FDMS reports the change to the parent object's > destination and only tells you that the property of the parent changed. > We do give you the complete old and new values though of the parent > object so you can walk down and compare them to figure out the details > of what changed. Whenever you use this approach, the entire object > graph gets shipped back and forth for each change so it gets inefficient > as the object graph gets bigger. > > > > In this particular case, it sounds like the managed association feature > would be the best approach. You can create new objects on either the > client or the server - whichever makes the most sense for your > application. Simply adding a new object to the property of another > managed object is enough to "create it" for the system. We'll detect > that it is a new object and log both the create and update operations as > part of the batch. When you issue the "commit" call, both are sent to > the server as part of the same batch. > > > > Jeff > > > > > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of simonjpalmer > Sent: Sunday, January 28, 2007 12:56 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] parent-child hierarchy of data using Flex, FDS and > Hibernate > > > > Hi, > > I have a 4 level hierarchy of data in my application with a > bi-directional one-to-many relationship between each level as follows: > > PlanPoint (parent) > -- UserScenario (child) > Scenario (grandchild) > -- Competitor (great grandchild) > > I have a hibernate back end running under JBoss and I am using FDS to > synchronise the changes from my Flex UI. My DB will be Oracle, but > for the time being I am just testing with a HSQLDB for convenience. > > I have managed to create a destination in FDS which will retrieve the > parent objects. The hibernate mapping docs specify the further > retrieval of the graph of objects attached to them. This all works > fine and performs reasonably well, although I have been unable to get > any meaningful lazy loading to work (a problem for another time). > > My problem comes in that the user will interact deeply with the graph > of objects during the client session. This includes adding, removing > and updating objects at all levels. > > What I can't seem to get right is the interaction in the Flex layer > which copes with this level of interaction. > > For instance if I want to add a new Competitor to a