[flexcoders] LCDS: Destination inheritance - is this a working feature?

2009-07-22 Thread gordon_greg
Greetings,

I've got a problem with setting up a model hierarchy that requires using the 
extends attribute of a DataService Destination in LCDS, but it doesn't 
exactly work.

I'm noticing some rather obvious issues (bugs?) that involve lazy associations 
on sub-classes when there is no lazy association on the base class.

Furthermore, if I point to my hierarchical class(es) from a separate class (one 
that actually requires a join table in between), then none of the subclass 
properties are loaded at all, only the base class properties are loaded.

I'm happy to provide as much information as necessary if anyone has any 
guidance for me.

Thanks,

Greg Gordon 



[flexcoders] Re: LCDS: Problem with destination inheritance

2008-07-15 Thread gordon_greg
Hi Jeff,

Thanks for the usual quick response, the workaround is fine for the
time being, looking forward to the update release.

greg

--- In flexcoders@yahoogroups.com, Jeff Vroom [EMAIL PROTECTED] wrote:

 Hi Greg,
 
 Yeah, thanks for sending this as it did uncover an LC DS bug.  It
occurs with the combination of the deleteItem and the commit(item)
or commit([item]) case.  The code is trying to look up the DataService
associated with the item in the argument... to do that we look in the
cache for each item.  We can't find it (since it has been deleted) and
the code is improperly returning the last data service in the list. 
So when it works, it is because the list of data services is generated
in some particularly lucky order.
 
 If you can commit everything - not just that item, that would be an
easy workaround though most likely you are using that variant of
commit for a reason.
 
 I'll contact you off-list to get you a patched fds.swc to try out
the fix.   For your reference, the bug number I filed is:
 
 https://bugs.adobe.com/jira/browse/LCDS-351
 
 Jeff
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of gordon_greg
 Sent: Thursday, July 03, 2008 12:53 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] LCDS: Problem with destination inheritance
 
 
 Hello,
 
 I'm using the latest LCDS 2.6.RC1 with the HibernateAssembler and a
 non-trivial data model that relies upon destination inheritance in a
 few places.
 
 In general everything works great, but occasionally, when I remove an
 element from a collection using dataService.deleteItem, when I then
 call dataService.commit, I end up with an exception that indicates
 that the wrong destination is being invoked...
 
 For our purposes, let's just deal with 4 destinations:
 
 Folder
 ResourceFolder (extends folder)
 Meeting
 MeetingParticipant (is a many-to-one child of Meeting)
 
 Now, if I call:
 
 meetingParticipantDataService.deleteItem(meetingParticipant);
 
 meetingParticipantDataService.commit([meetingParticipant],true);
 
 I end up with the following exception:
 
 == begin exception 
 
 Error: Destination: spring.folder received an instance of class:
 demo.model.meetings::MeetingParticipant but we could not find a
 destination in the list of sub-types: spring.resourceFolder which
 extends this destination.
 at

mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::getDestinationForInstance()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\ConcreteDataService.as:5309]
 at

mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::getItemDestination()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\ConcreteDataService.as:5290]
 at

mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::getItemMetadata()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\ConcreteDataService.as:5275]
 at

mx.data::MessageBatch/addMessageIdsForItem()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\MessageBatch.as:591]
 at

mx.data::MessageBatch/extractMessages()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\MessageBatch.as:456]
 at

mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::doCommit()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\DataStore.as:1807]
 at

mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::internalCommit()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\DataStore.as:818]
 at

mx.data::ConcreteDataService/commit()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\ConcreteDataService.as:337]
 at

mx.data.mxml::DataService/commit()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\mxml\DataService.as:433]
 at [my code here]
 
 == end exception 
 
 Note that there is no relationship at all between MeetingParticipant
 and Folder - they are completely independent of each other.
 
 This feels like a bug to me, because it doesn't always happen, is not
 reliable reproduced, and once it does happen it keeps happening until
 I clean out my browser's cache.
 
 Somehow, something gets the DataService layer in an unstable state,
 possibly as a side effect of some exception being thrown somewhere in
 my application (although this isn't clear either), and once it is in
 that state, it doesn't recover.
 
 Is anyone else seeing this? Should I be reporting this as a bug?
 
 I'd be happy to provide more information as necessary.
 
 Thanks.





[flexcoders] LCDS: Problem with destination inheritance

2008-07-03 Thread gordon_greg
Hello,

I'm using the latest LCDS 2.6.RC1 with the HibernateAssembler and a
non-trivial data model that relies upon destination inheritance in a
few places.

In general everything works great, but occasionally, when I remove an
element from a collection using dataService.deleteItem, when I then
call dataService.commit, I end up with an exception that indicates
that the wrong destination is being invoked...

For our purposes, let's just deal with 4 destinations:

Folder
ResourceFolder (extends folder)
Meeting
MeetingParticipant (is a many-to-one child of Meeting)

Now, if I call:

   meetingParticipantDataService.deleteItem(meetingParticipant);
   
   meetingParticipantDataService.commit([meetingParticipant],true);

I end up with the following exception:

== begin exception 

Error: Destination: spring.folder received an instance of class:
demo.model.meetings::MeetingParticipant but we could not find a
destination in the list of sub-types: spring.resourceFolder which
extends this destination.
at
mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::getDestinationForInstance()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\ConcreteDataService.as:5309]
at
mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::getItemDestination()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\ConcreteDataService.as:5290]
at
mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::getItemMetadata()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\ConcreteDataService.as:5275]
at
mx.data::MessageBatch/addMessageIdsForItem()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\MessageBatch.as:591]
at
mx.data::MessageBatch/extractMessages()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\MessageBatch.as:456]
at
mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::doCommit()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\DataStore.as:1807]
at
mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::internalCommit()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\DataStore.as:818]
at
mx.data::ConcreteDataService/commit()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\ConcreteDataService.as:337]
at
mx.data.mxml::DataService/commit()[C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\mxml\DataService.as:433]
at [my code here]

== end exception 

Note that there is no relationship at all between MeetingParticipant
and Folder - they are completely independent of each other.

This feels like a bug to me, because it doesn't always happen, is not
reliable reproduced, and once it does happen it keeps happening until
I clean out my browser's cache.

Somehow, something gets the DataService layer in an unstable state,
possibly as a side effect of some exception being thrown somewhere in
my application (although this isn't clear either), and once it is in
that state, it doesn't recover.

Is anyone else seeing this? Should I be reporting this as a bug?

I'd be happy to provide more information as necessary.

Thanks.




[flexcoders] Re: Use hibernate annotations with LiveCycle Data Services

2008-06-04 Thread gordon_greg
Hi.

I do indeed see that the
flex.data.assembler.HibernateAnnotationsAssembler is provided in the
flex.data.jar file distributed with LCDS 2.6b2.

However, I have no idea how to get it working:

I tried modifying the simple Contact demo using Hibernate that comes
as a sample for LCDS 2.6 to use annotations, and then I commented out
the following line in hibernate.cfg.xml:

   
   mapping resource=flex/samples/contact/Contact.hbm.xml/

Then I changed the data-management-config.xml entry for 

   destination id=hibernate-contact


To use 

  sourceflex.data.assemblers.HibernateAnnotationsAssembler/source

And I assumed this was all I would have to change to get this working.

However, when I attempt to start up the server, I simply get errors i.e.:

[Flex] [ERROR] MessageBroker failed to start:
flex.data.adapters.AdapterException: No Hibernate mapping was found
for entity name 'flex.samples.contact.Contact' configured in
destination 'hibernate-contact'. Please verify that your destination
configuration specifies a valid hibernate-entity/, or that the
destination id references a valid entity.
at flex.data.assemblers.HibernateType.start(HibernateType.java:195)
at
flex.data.assemblers.HibernateAssembler.start(HibernateAssembler.java:205)



I was not able to locate the source code for the
HibernateAnnotationsAssembler anywhere, nor can I find any reference
to this file in any other forum, site, document, etc.

I did look at the decompiled code, and I can see that it simply
extends the Hibernate assebmler, and over-writes the
createHiberanteConfigureation method, but again, I just don't know
what the magic is to get this thing configured and reading in
annotation information.

Any small, simple example would be just lovely.

Thanks!

Greg Gordon




--- In flexcoders@yahoogroups.com, Jeff Vroom [EMAIL PROTECTED] wrote:

 The 2.6 beta (on labs.adobe.com) has annotations support built in - you
 have to use the HibernateAnnotationsAssembler instead of the
 HibernateAssembler in your data-management-config.xml.  It is not too
 hard to add to 2.5.1 if you need it there too... there are some new jar
 files you need to add and you need to override a method in the
 HibernateAssembler to specify a different class to bootstrap the
 configuration.   The source for this is also in the 2.6 beta if you want
 to check it out.
 
  
 
 Jeff
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Mathieu Fernandez
 Sent: Wednesday, April 30, 2008 3:24 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Use hibernate annotations with LiveCycle Data
 Services
 
  
 
 Hello,
 I'm trying to use hibernate annotations with LiveCycle Data Services.
 My problem is when I launch my server I have this error :
 An annotationConfiguration instance is required to use mapping 
 class=...
 So I would like to know how enabling annotation configuration?
 Thanks





[flexcoders] Re: Use hibernate annotations with LiveCycle Data Services

2008-06-04 Thread gordon_greg
Allow me to answer my own quetions:

1) rather removing the mapping line from hibernate.cfg.xml, I had to
replace it with

 mapping class=flex.samples.contact.Contact/

2) had to ensure the the named query all was defined at the top of the
Contact class i.e.


@NamedQuery(name=all, query=From Contact)

That pretty much did it - required no other changes to the
data-management-config.xml other than specifying
HibernateAnnotationsAssembler...

And for any one out there who may care, the following is the full
Contact.java class modified to use annotations:

package flex.samples.contact;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name=contact)
@NamedQuery(name=all, query=From Contact)
public class Contact {

 private int contactId;

 private String firstName;
 private String lastName;
 private String address;
 private String city;
 private String state;
 private String zip;
 private String country;
 private String email;
 private String phone;
 private String notes;

 @Id
 @GeneratedValue(strategy=GenerationType.AUTO)
 @Column(name=contact_id)
 public int getContactId() {
 return contactId;
 }
 public void setContactId(int contactId) {
 this.contactId = contactId;
 }

 public String getAddress() {
 return address;
 }
 public void setAddress(String address) {
 this.address = address;
 }
 public String getCity() {
 return city;
 }
 public void setCity(String city) {
 this.city = city;
 }

 public String getCountry() {
 return country;
 }
 public void setCountry(String country) {
 this.country = country;
 }
 public String getEmail() {
 return email;
 }
 public void setEmail(String email) {
 this.email = email;
 }


 @Column(name=first_name)
 public String getFirstName() {
 return firstName;
 }
 public void setFirstName(String firstName) {
 this.firstName = firstName;
 }


 @Column(name=last_name)
 public String getLastName() {
 return lastName;
 }
 public void setLastName(String lastName) {
 this.lastName = lastName;
 }
 public String getNotes() {
 return notes;
 }
 public void setNotes(String notes) {
 this.notes = notes;
 }
 public String getPhone() {
 return phone;
 }
 public void setPhone(String phone) {
 this.phone = phone;
 }
 public String getState() {
 return state;
 }
 public void setState(String state) {
 this.state = state;
 }
 public String getZip() {
 return zip;
 }
 public void setZip(String zip) {
 this.zip = zip;
 }


}

--- In flexcoders@yahoogroups.com, gordon_greg [EMAIL PROTECTED] wrote:

 Hi.

 I do indeed see that the
 flex.data.assembler.HibernateAnnotationsAssembler is provided in the
 flex.data.jar file distributed with LCDS 2.6b2.

 However, I have no idea how to get it working:

 I tried modifying the simple Contact demo using Hibernate that comes
 as a sample for LCDS 2.6 to use annotations, and then I commented out
 the following line in hibernate.cfg.xml:


mapping resource=flex/samples/contact/Contact.hbm.xml/

 Then I changed the data-management-config.xml entry for

destination id=hibernate-contact


 To use

   sourceflex.data.assemblers.HibernateAnnotationsAssembler/source

 And I assumed this was all I would have to change to get this working.

 However, when I attempt to start up the server, I simply get errors
i.e.:

 [Flex] [ERROR] MessageBroker failed to start:
 flex.data.adapters.AdapterException: No Hibernate mapping was found
 for entity name 'flex.samples.contact.Contact' configured in
 destination 'hibernate-contact'. Please verify that your destination
 configuration specifies a valid hibernate-entity/, or that the
 destination id references a valid entity.
  at flex.data.assemblers.HibernateType.start(HibernateType.java:195)
  at

flex.data.assemblers.HibernateAssembler.start(HibernateAssembler.java:20\
5)
 


 I was not able to locate the source code for the
 HibernateAnnotationsAssembler anywhere, nor can I find any reference
 to this file in any other forum, site, document, etc.

 I did look at the decompiled code, and I can see that it simply
 extends the Hibernate assebmler, and over-writes the
 createHiberanteConfigureation method, but again, I just don't know
 what the magic is to get this thing configured and reading in
 annotation information.

 Any small, simple example would be just lovely.

 Thanks!

 Greg Gordon




 --- In flexcoders@yahoogroups.com, Jeff Vroom jvroom@ wrote:
 
  The 2.6 beta (on labs.adobe.com

[flexcoders] Flex DataService problem: unexpected unsubscribe and release collection ops

2008-04-01 Thread gordon_greg
Hello,

I have a small, yet increasingly, complex application begun using Flex
DataServics / Tomcat / Spring / Hibernate, and am running into what
apparently are not uncommon limitations with regards to the complexity
of the data model when using DataServices.

The skinny: when deleting an item from a managed collection, instead of
the client issuing the correct 'update' operation on the collection,
some internal Adobe code detects something that results in the entire
collection being released, the consumer being unsubscribed, and the
destination being disconnected...

By and large things work well, but I recently added in some inheritance
to a particular table that may or may not be causing me trouble.

Before getting overly detailed as to my exact data model, let's try the
following summary:

1) table Presentation has a collection of slides

2) table Slide is extended by table SlideMaster and
SlideReference, joined on a shared primary key

3) table SlideMaster has a collection of slideElements, and
slideReferences

4) table SlideReference simply points back to a parent slideMaster

For my destination configuration, I actually define a destination for
each table: spring.presentation, spring.slide, spring.slideMaster,
spring.slideReference, etc.

Note: all DataServices are set to autoCommit = false, and autoSync =
true.

Note that this is not actually the top of my object tree, but let's just
deal with the notion of adding and removing Slides from a Presentation.

I can properly add slides by:
mySlide = new SlideMaster();
mySlide.presentation = myPresentation;
myPresentation.slides.addItem(mySlide);
// then do a commit
This works fine.

However, when I attempt to remove a slide:
index = myPresentation.slides.getElementIndex(mySlide);
myPresentation.removeItemAt(index);
What happens is very odd and very frustrating.

I have ALL of the debug logging enabled, so the first thing I see is a
message queued to destination spring.presentation, operation = update.
This is as expected.

Next, I see the propertyChangedEvent handlers called on my DataServices,
indicating that commitRequired has gone from false to true, again as
expected.

However - when not stepping through breakpoints, etc., the next thing
that happens is a subsequent call to the properyChangedEvent handlers,
indicating that commitRequired is now FALSE, and this is followed by the
client issuing the following log messages:
 logging start ---
4/1/2008 14:37:32.233 [INFO] mx.messaging.Consumer
'cds-consumer-spring.slide-null' consumer unsubscribe.
4/1/2008 14:37:32.235 [WARN] mx.messaging.Consumer
'cds-consumer-spring.slide-null' consumer channel disconnected.
4/1/2008 14:37:32.236 [INFO] mx.messaging.Producer
'ds-producer-spring.library' producer sending message
'296B7FA3-B4AB-2F9E-5FE8-0B479ACC829B'
4/1/2008 14:37:32.238 [DEBUG] mx.messaging.Channel 'my-amf' channel
sending message:

[... operation = release; destination = spring.slide ...]

4/1/2008 14:37:32.240 [INFO] mx.messaging.Consumer
'cds-consumer-spring.presentation-null' consumer unsubscribe.
4/1/2008 14:37:32.240 [WARN] mx.messaging.Consumer
'cds-consumer-spring.presentation-null' consumer channel disconnected.
4/1/2008 14:37:32.240 [INFO] mx.messaging.Producer
'ds-producer-spring.library' producer sending message
'ADABC35E-C24F-283B-46DC-0B479AD08F51'
4/1/2008 14:37:32.242 [DEBUG] mx.messaging.Channel 'my-amf' channel
sending message:

[... operation = release; destination = spring.presentation ...]
 logging end ---

Basically, when I remove mySlide from the myPresentation.slides
collection, after DataServices queues up the correct udpate message and
sets commitRequired to true, something else happens way beneath the
covers that results in this errant cancellation of the update, and
subsequent release of the collections.

I attempted to dig deeper by stopping execution at the point at which
the second call was made to the propertyChangedEvent handler, and found
the reason for this behavior has something to do with some internal
Adobe classes, and seems most specifically due to something called
releaseItemIfNoDataListReferences, which seems to get something
confused... either as though the entire myPresentation.slides collection
should be released, or... or what, I'm not sure, but it is at this
point, if I step through the code (without of course being able to see
the code, since I don't have the source) that things change and those
releases occur.

Here is the stack at the point at which my PropertyChange handler is
notified that commitRequired is now false:
com.nv.client.model::PresentationsProxy/handlePropertyChange
flash.events::EventDispatcher/dispatchEventFunction [no source]
flash.events::EventDispatcher/dispatchEvent [no source]
flash.events::EventDispatcher/dispatchEventFunction [no source]
flash.events::EventDispatcher/dispatchEvent [no source]
flash.events::EventDispatcher/dispatchEventFunction [no