[flexcoders] Re: FDS/Hibernate/MySql data update question

2007-03-27 Thread jwp2k_uva
Robert, 

Thanks for the design input.  I guess there is no helping it if I want
MySql database to have heterogeneous accessors.  My preliminary search
indicates that Oracle my be the only db that supports change event. 

By the way, nice work with SearchCoders.com/felx app.  It looks awesome.

- Jae


--- In flexcoders@yahoogroups.com, Robert Cadena <[EMAIL PROTECTED]> wrote:
>
> Jae,
> glad to help.  I doubt there is a change event support in the jdbc 
> connector, but I may be wrong.
> 
> One way you'd be able to notify your fds webapp that a change occurred 
> is to expose an internal facing service (webservice,restful, jms?) to 
> your other app.
> 
> For example, our searchcoders.com/flex app runs a couple of shell 
> scripts to perform maintenance and email retrieval at periodic 
> intervals.  I wanted to keep track of when new messages were downloaded 
> from the group and indexed in a simple flex-based admin console.  so, 
> when the batch script finishes dling and indexing stuff it makes a curl 
> request to an internal-facing server running fds, which sends an update 
> event over a transaction, just as i described in my reply.  then my 
> admin client, which is already connected to the internal server fds 
> instance, receives a push update.  Of course, i could have simply had 
> the shell script send me an email, but, we're testing out how to work 
> and integrate fds and wanted to see this sort of notification strategy 
> in action.
> 
> /r
> http://www.searchcoders.com/flex/?dataservicetransaction+php+net
> 
> 
> 
> jwp2k_uva wrote:
> > Robert,
> > 
> > Thanks a million for pointing out DataServiceTransaction ;)  This is
> > awesome.  
> > 
> > I wonder now whether there is a db change event support in MySql/JDBC
> > connector that allows a java object to call DataServiceTranaction
> > functions as you described below whenever the database of interest is
> > changed regardless of who (.NET, PHP, etc.) changed it. 
> > 
> > You've been a great help.  Thanks, again.
> > 
> > - Jae 
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "robert_cadena"  wrote:
> >> Hi,
> >>
> >> if i understand you correctly you want to tell a flex client that a
> >> change in a db row occurred, yet the change was not initiated by that
> >> client and/or you're not in the middle of an assembler operation?
 For
> >> example, if some other non-flex related entity changed a db row you
> >> want to notify the flex client.  
> >>
> >> If this is the case have a look at the "DataServiceTransaction" class
> >> in the FDS javadocs.  You create a new transaction using that class'
> >> "begin" static method.  Here's some pseudocode:
> >>
> >> tx = DataServiceTransaction.begin();
> >> tx.updateItem("destination_name", newVersion, prevVersion,
changesList);
> >> tx.commit();
> >>
> >> This bit of code will send an update event to the clients subscribed
> >> to destination.
> >>
> >> Keep in mind you have to be within the same webapp as the FDS.  
> >>
> >> Hope that helps.
> >>
> >> /r
> >> http://www.searchcoders.com/flex/?dataservicetransaction
> >>
> >>
> >>
> >> --- In flexcoders@yahoogroups.com, "jwp2k_uva"  wrote:
> >>> Dear Flexcoders,
> >>>
> >>> In a FDS/Hibernate/MySql setup, what happens if a data row is
directly
> >>> updated in the MySql database?  Is there a simple way to update the
> >>> flex application with the updated data row?
> >>>
> >>> Thanks a million.
> >>>
> > 
> > 
> > 
> > 
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> > Yahoo! Groups Links
> > 
> > 
> > 
> >
>




Re: [flexcoders] Re: FDS/Hibernate/MySql data update question

2007-03-27 Thread Robert Cadena
Jae,
glad to help.  I doubt there is a change event support in the jdbc 
connector, but I may be wrong.

One way you'd be able to notify your fds webapp that a change occurred 
is to expose an internal facing service (webservice,restful, jms?) to 
your other app.

For example, our searchcoders.com/flex app runs a couple of shell 
scripts to perform maintenance and email retrieval at periodic 
intervals.  I wanted to keep track of when new messages were downloaded 
from the group and indexed in a simple flex-based admin console.  so, 
when the batch script finishes dling and indexing stuff it makes a curl 
request to an internal-facing server running fds, which sends an update 
event over a transaction, just as i described in my reply.  then my 
admin client, which is already connected to the internal server fds 
instance, receives a push update.  Of course, i could have simply had 
the shell script send me an email, but, we're testing out how to work 
and integrate fds and wanted to see this sort of notification strategy 
in action.

/r
http://www.searchcoders.com/flex/?dataservicetransaction+php+net



jwp2k_uva wrote:
> Robert,
> 
> Thanks a million for pointing out DataServiceTransaction ;)  This is
> awesome.  
> 
> I wonder now whether there is a db change event support in MySql/JDBC
> connector that allows a java object to call DataServiceTranaction
> functions as you described below whenever the database of interest is
> changed regardless of who (.NET, PHP, etc.) changed it. 
> 
> You've been a great help.  Thanks, again.
> 
> - Jae 
> 
> 
> --- In flexcoders@yahoogroups.com, "robert_cadena" <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> if i understand you correctly you want to tell a flex client that a
>> change in a db row occurred, yet the change was not initiated by that
>> client and/or you're not in the middle of an assembler operation?  For
>> example, if some other non-flex related entity changed a db row you
>> want to notify the flex client.  
>>
>> If this is the case have a look at the "DataServiceTransaction" class
>> in the FDS javadocs.  You create a new transaction using that class'
>> "begin" static method.  Here's some pseudocode:
>>
>> tx = DataServiceTransaction.begin();
>> tx.updateItem("destination_name", newVersion, prevVersion, changesList);
>> tx.commit();
>>
>> This bit of code will send an update event to the clients subscribed
>> to destination.
>>
>> Keep in mind you have to be within the same webapp as the FDS.  
>>
>> Hope that helps.
>>
>> /r
>> http://www.searchcoders.com/flex/?dataservicetransaction
>>
>>
>>
>> --- In flexcoders@yahoogroups.com, "jwp2k_uva"  wrote:
>>> Dear Flexcoders,
>>>
>>> In a FDS/Hibernate/MySql setup, what happens if a data row is directly
>>> updated in the MySql database?  Is there a simple way to update the
>>> flex application with the updated data row?
>>>
>>> Thanks a million.
>>>
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> Yahoo! Groups Links
> 
> 
> 
> 


[flexcoders] Re: FDS/Hibernate/MySql data update question

2007-03-27 Thread jwp2k_uva
Robert,

Thanks a million for pointing out DataServiceTransaction ;)  This is
awesome.  

I wonder now whether there is a db change event support in MySql/JDBC
connector that allows a java object to call DataServiceTranaction
functions as you described below whenever the database of interest is
changed regardless of who (.NET, PHP, etc.) changed it. 

You've been a great help.  Thanks, again.

- Jae 


--- In flexcoders@yahoogroups.com, "robert_cadena" <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> if i understand you correctly you want to tell a flex client that a
> change in a db row occurred, yet the change was not initiated by that
> client and/or you're not in the middle of an assembler operation?  For
> example, if some other non-flex related entity changed a db row you
> want to notify the flex client.  
> 
> If this is the case have a look at the "DataServiceTransaction" class
> in the FDS javadocs.  You create a new transaction using that class'
> "begin" static method.  Here's some pseudocode:
> 
> tx = DataServiceTransaction.begin();
> tx.updateItem("destination_name", newVersion, prevVersion, changesList);
> tx.commit();
> 
> This bit of code will send an update event to the clients subscribed
> to destination.
> 
> Keep in mind you have to be within the same webapp as the FDS.  
> 
> Hope that helps.
> 
> /r
> http://www.searchcoders.com/flex/?dataservicetransaction
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "jwp2k_uva"  wrote:
> >
> > Dear Flexcoders,
> > 
> > In a FDS/Hibernate/MySql setup, what happens if a data row is directly
> > updated in the MySql database?  Is there a simple way to update the
> > flex application with the updated data row?
> > 
> > Thanks a million.
> >
>




[flexcoders] Re: FDS/Hibernate/MySql data update question

2007-03-27 Thread robert_cadena
Hi,

if i understand you correctly you want to tell a flex client that a
change in a db row occurred, yet the change was not initiated by that
client and/or you're not in the middle of an assembler operation?  For
example, if some other non-flex related entity changed a db row you
want to notify the flex client.  

If this is the case have a look at the "DataServiceTransaction" class
in the FDS javadocs.  You create a new transaction using that class'
"begin" static method.  Here's some pseudocode:

tx = DataServiceTransaction.begin();
tx.updateItem("destination_name", newVersion, prevVersion, changesList);
tx.commit();

This bit of code will send an update event to the clients subscribed
to destination.

Keep in mind you have to be within the same webapp as the FDS.  

Hope that helps.

/r
http://www.searchcoders.com/flex/?dataservicetransaction



--- In flexcoders@yahoogroups.com, "jwp2k_uva" <[EMAIL PROTECTED]> wrote:
>
> Dear Flexcoders,
> 
> In a FDS/Hibernate/MySql setup, what happens if a data row is directly
> updated in the MySql database?  Is there a simple way to update the
> flex application with the updated data row?
> 
> Thanks a million.
>




Re: [flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of values

2007-02-27 Thread Chris Allen
 a) much simpler and b) more robust than the way the current code
> > works.
> >
> >
> >
> > Unfortunately we've made enough changes to the code surrounding the
> > HibernateAssembler so I can't just send you the updated file and
have it
> > work in FDS2. It will be in an upcoming public beta but I don't think
> > we've announced the dates on that.
> >
> >
> >
> > Jeff
> >
> >
> >
> > 
> >
> > From: flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com ] On
> > Behalf Of parkerwhirlow
> > Sent: Thursday, February 15, 2007 3:29 PM
> > To: flexcoders@yahoogroups.com 
> > Subject: [flexcoders] Re: FDS/Hibernate Sample of updating
hierarchical
> > list of values
> >
> >
> >
> > Hey Jeff, just curious if you've got any updated HibernateAssembler
> > code with some fixes? Any idea when this would be available?
> >
> > thanks,
> > PW
> >
> > --- In flexcoders@yahoogroups.com 
<mailto:flexcoders% 40yahoogroups.com>
> > , "Jeff Vroom"  wrote:
> > >
> > > My apologies - this does look like a bug. I need to do more
testing on
> > > this case myself, but I think one of the big problems here is
that we
> > > are trying to do conflict detection on our own in the hibernate
> > > assembler's updateItem method. Unless you are using a strict
isolation
> > > level in your DB (repeatable read or serializable) this is not going
> > to
> > > be transactionally correct anyway since the DB version can be
modified
> > > after we have executed the query and before we do our update. We
> > > probably should not be getting the server version at all...
hibernate
> > > has its own optimistic concurrency support that we should be
using if
> > it
> > > is enabled. That is probably the only way to get atomic conflict
> > > detection without resorting to using those particularly slow
isolation
> > > levels.
> > >
> > >
> > >
> > > That would potentially get rid of the conflicting version of the
item
> > in
> > > the transaction. The other thing I need to look into is the "merge"
> > > method in hibernate. Seems like we should probably be using that in
> > the
> > > updateItem method? I'll be working on this next week so will
send out
> > > any updates I can to the code.
> > >
> > >
> > >
> > > Jeff
> > >
> > >
> > >
> > > 
> > >
> > > From: flexcoders@yahoogroups.com 
<mailto:flexcoders% 40yahoogroups.com>
> > [mailto:flexcoders@yahoogroups.com 
<mailto:flexcoders% 40yahoogroups.com>
> > ] On
> > > Behalf Of parkerwhirlow
> > > Sent: Thursday, February 01, 2007 6:05 PM
> > > To: flexcoders@yahoogroups.com 
<mailto:flexcoders% 40yahoogroups.com>
> > > Subject: [flexcoders] FDS/Hibernate Sample of updating hierarchical
> > list
> > > of values
> > >
> > >
> > >
> > >
> > > Hi all,
> > >
> > > I have been tearing my hair out trying to get FDS/Hibernate to
update
> > > a hierarchical list of values. Even the simplest of collection
> > > mappings in Hibernate cause various exceptions when trying to
update.
> > >
> > > Before I post my details, does anyone have any examples of this that
> > > work? Has anyone ever even gotten this to work?
> > >
> > > I have two objects mapped in Hibernate:
> > >
> > > - Family
> > > Person
> > >
> > > where a Family has a Set of Person "familyMembers".
> > >
> > > My FDS destination is to Family, and I am trying to update a family
> > > member (just the name) through this destination.
> > >
> > > First, I was getting Hibernate NonUniqueObjectException, which I
> > > finally tracked down to having my hibernate collection mapping
set to
> > > lazy=false This caused all of the family member Person objects to be
> > > loaded into the PersistenceContext when the HibernateAssembler
loaded
> > > the "serverVersion" of the Family.
> > >
> > > Then, once I set lazy=true on the collection mapping, I was
getting an
> > > exception that "A collection with cascade="all-delete-orphan" was no
> > > longer referenced by the owning entity instance"... since it is
> > > assigning a whole new collection to the familyMembers property one
> > > becomes unreferenced, and the other referenced. Sooo I can't use
> > > delete orphan to delete the family members when the family is
> > > deleted... OK. So then I make cascade="all".
> > >
> > > Now I'm getting "ORA-01407: cannot update
> > > ("SCHEMA"."T_PERSON"."FAMILYID") to NULL"... I'm guessing that it's
> > > processing the dereferenced collection first (trying to detatch any
> > > Person's from the family before they're re-attached by the new
> > > collection. I can't believe this is so difficult...
> > >
> > > For more info on my setup and test case, please see my original
post:
> > > http://tech.groups.yahoo.com/group/flexcoders/message/63308
> > <http://tech.groups.yahoo.com/group/flexcoders/message/63308>
> > > <http://tech.groups.yahoo.com/group/flexcoders/message/63308
> > <http://tech.groups.yahoo.com/group/flexcoders/message/63308> >
> > >
> > > any comments as to if anyone has done this successfully are greatly
> > > appreciated!
> > >
> > > thanks,
> > > PW
> > >
> >
>

 



Re: [flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of values

2007-02-26 Thread Valy Sivec
That's an excellent message and I had ran through same issues myself and feel 
your pain...

Regards,
Valy 

- Original Message 
From: simonjpalmer <[EMAIL PROTECTED]>
To: flexcoders@yahoogroups.com
Sent: Friday, February 23, 2007 5:34:38 AM
Subject: [flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of 
values









  



PW and Jeff,



PW, you and I seem to be in the same boat.  I am trying to fight off

the people who were flex skeptics to start with.  Not being able to

write data back makes the whole thing look pretty amateur and confirms

people's belief that the technology isn't ready - which given this

experience it clearly isn't.  The baby is definitely at risk of being

thrown out with the bath water.  It stands in our company simply

because I have the final call as Technical Director (CTO if you are in

the US).



I am a huge flex advocate and really doing my best to evangelise on

the topic.  What's more I think that the bridge to operational data is

the most profound leap forward for flash, it takes it out of the world

of gimicks and into the world of real business applications.  



Jeff, you and your and team deserve huge credit for that vision and

excellent execution.



However, much as it pains me to say it, the bottom line is that the

hibernate middle tier provided does not work, as PW and I (and a host

of other people on various forums) have found.  I know that I can

re-write the whole thing myself and will probably have to, but when

introducing new technologies it is unfortunately all about initial

perception.  



I have made a career of doing this sort of thing myself and I have

seen excellent projects fail to fly because of low initial quality,

even though we fixed them immediately, the damage was done because

people's impression was that they were flaky.  I'm sure you know it is

hard to get back from that first impression and the word of mouth that

springs from it.  Once it becomes entrenched that opinion becomes fact

and you are irrevocably lost.  If I were Adobe I would be a little

worried about the tone of the posts I am seeing about integration with

Hibernate.



The Hibernate Assembler is very important and I would really hate to

see that happen to it.  The corollary is very unfortunate.  That

little bit of technology transform the boardroom conversation about

FDS.  Suddenly the cost of the licensing of FDS becomes justifiable

against the dev cost savings because we can just plug into the ORM. 

Having made that justification myself it is very difficult for me now

to go back and say, "by the way I also have to incur the dev costs". 

When asked why? I have to confess that the Adobe code doesn't work and

we don't know when we're getting a fix.  For the Flex/Flash skeptics

in the room that's a god send.



For me it is a complete nightmare.  It is hard for me to separate the

cost of FDS licenses (which is almost prohibitively large) against the

cost of dev.  I would urge Jeff and Co to get the Hibernate Assembler

code watertight and shipping asap.  If I can be of any assistance I

will gladly offer my services.



If either of you would like to contact me, post a reply and I will

happily give you my details.



Simon Palmer

Technical Director

The PMCo

62 St Peters Street

St Albans

HERTS  AL1 3HG

UK



--- In [EMAIL PROTECTED] ups.com, "parkerwhirlow" 

wrote:

>

> Thats very unfortunate. I'm getting farther and farther into hot water

> not being able to reliably update our data model using Flex.

> 

> Last it was "just wait for 2.0.1, there's a lot of Hibernate/FDS fixes

> in it" and now we're waiting for another unknown amount of time for

> fixes we can only hope will help our situation.

> 

> I'm apologize, I understand it's not your fault, and I really

> appreciate the insight you provide as to what can be causing our

> problems, I'm just getting up to my neck in unsolved problems.

> 

> If you have any insight as to "roughly" when this next release could

> occur, can you tip me off?

> 

> thanks,

> PW

> 

> --- In [EMAIL PROTECTED] ups.com, "Jeff Vroom"  wrote:

> >

> > I have finished making the changes and the use of the "merge" call

seems

> > to be a) much simpler and b) more robust than the way the current code

> > works.   

> > 

> >  

> > 

> > Unfortunately we've made enough changes to the code surrounding the

> > HibernateAssembler so I can't just send you the updated file and

have it

> > work in FDS2.  It will be in an upcoming public beta but I don't think

> > we've announced the dates on that.  

> > 

> >  

> > 

> > Jeff

> > 

> >  

[flexcoders] Re: FDS/Hibernate - LazyInitializationException when writing AMF output

2007-02-25 Thread simonjpalmer
Eric,

I am also very interested in getting on a beta program too.  I have
sent you an email with contact details for me.

Regards
Simon

--- In flexcoders@yahoogroups.com, "Eric D Anderson" <[EMAIL PROTECTED]> wrote:
>
> Hi PW,
> 
>  
> 
> I'd suggest that we add you to the latest Data Services beta because
> either we have fixed this issue, or we will fix this issue in the next
> release.  Can you contact me off-list and I'll add you to the beat so
> you can test DS with the latest DS and hibernate assembler.
> 
>  
> 
> Thanks
> 
> 
> Eric
> 
>  
> 
> Flex PM
> 
>  
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of parkerwhirlow
> Sent: Friday, February 16, 2007 7:06 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: FDS/Hibernate - LazyInitializationException
> when writing AMF output
> 
>  
> 
> This is happening from FDS... flex.data.assemblers.HibernateAssembler
> uses a function called fetchObjectProperties() that's supposed to load
> them all while the session is open right?
> 
> I've seen in other posts that FDS eager fetches the properties in the
> Assembler, so that they are available during serialization... 
> 
> am I missing something here?
> 
> thanks,
> PW
> 
> --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> , Dima Gutzeit  wrote:
> >
> > Hi,
> > 
> > You have to initialize the collections before AMF serializes them. The
> 
> > problem occurs since you closing Hibernate session without first 
> > initializing the arrays, and since you are using lazy initialization
> the 
> > problem arise.
> > 
> > You have two options :
> > 
> > 1. Use lazy=false
> > 2. Better one, is calling
> /Hibernate.initialize(your_array_reference);/ 
> > before you close the Hibernate session.
> > 
> > Regards,
> > Dima Gutzeit.
> > 
> > parkerwhirlow wrote:
> > >
> > > Hi again =)
> > >
> > > I've just started getting this exception inconsistently... sometimes
> > > it happens 3 times in a row, other times I can go all afternoon
> > > without getting it. Once the exception occurs, it will occur every
> > > time the client loads until FDS is restarted.
> > >
> > > Note this occurs on multiple collections. I tried setting the
> > > "offending" collection to lazy=false (in Hibernate), and the
> exception
> > > occurred on a different collection. I can't set every one of my
> > > collections to lazy=false. Especially since at this point, they HAVE
> > > to be lazy for the updateItem via hierarchical values to almost
> work.
> > >
> > > I also noticed that the collection does not necessarily need to have
> > > any items in it. (And possibly is caused specifically by NOT having
> > > any items in it, I can't tell for sure). The collection referenced
> in
> > > the exception below has no values, and there's another collection in
> > > that same class with values that doesn't seem to cause the
> exception.
> > >
> > > See below the hibernate mapping, and exception output when this
> > > occurs. (Note there are no FDS managed associations for this
> collection)
> > >
> > > Thanks for any insight you have as to what is causing this.
> > >
> > > PW
> > > _
> > >
> > > 
> > > 
> > > 
> > > 
> > >  > > inverse="false"
> > > cascade="all-delete-orphan" >
> > > 
> > > 
> > > 
> > > 
> > > 
> > > ...
> > > 
> > >
> > > 10:19:42,093 WARN ProxyWarnLog - Narrowing proxy to class
> > > config.test.Adult - this operation breaks ==
> > > 10:19:44,687 ERROR LazyInitializationException - failed to lazily
> > > initialize a collection of role: config.test.Adult.children, no
> > > session or session was closed
> > > org.hibernate.LazyInitializationException: failed to lazily
> initialize
> > > a collection of role: config.test.Adult.children, no session or
> > > session was closed
> > > at
> > >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializ
> ationException(AbstractPersistentCollection.java:358)
> > > at
> > >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializ
> ationExceptionIfNotConnected(

[flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of values

2007-02-24 Thread simonjpalmer
Jeff,

thanks very much for taking the time to reply, I appreciate it.  I
would be very happy to be engaged in the beta process.  Can you give
me some indication of what I might have to do in order to add my name
to the list of beta sites?  

Is it possible for you to give a rough date when we might expect the
beta to start (to which you will not be held)?  The reason I ask is
that I have a pressing and immediate need to have this addressed and
about to undertake an initiative to replace the Hibernate Assembler
(probably a Spring/Hibernate Java Assembler of some kind).  If the
beta is soon I may hold off and put attention elsewhere.  

Any insight you could give would be greatly appreciated.

Kind regards

Simon Palmer


--- In flexcoders@yahoogroups.com, "Jeff Vroom" <[EMAIL PROTECTED]> wrote:
>
> My apologies for the Hibernate problems y'all have been having.  We do
> have a bunch of users happily using this for relatively simple use cases
> but as your domain models grow in complexity, you may run into some
> problems.
> 
>  
> 
> Here are the set of problems I currently know about.  
> 
>  
> 
> 1)   unique object exceptions during "updateItem".  The one case
> where I know this will happen is if you have hibernate associations
> which do not have corresponding FDS associations (i.e. the hierarchical
> values).  This should be supported and it turns out that the fix for the
> problem is to use hibernate's "merge" method instead of trying to do the
> merge by hand as is done in 2.0.1's updateItem method.   The code in
> updateItem that is causing the bulk of this problem is the code which
> fetches the current server version to do conflict detection.  In doing
> that, it creates hibernate instances in the session which may conflict
> with instances that get sent in by the client.  Hibernate's "merge"
> method takes care of all of this for us.
> 
> 2)   Domain objects need id/equals test which is based on the id.
> Some of the code in the hibernate assembler is using the "equals" method
> when it should be comparing the id properties.  You can workaround this
> by having equals and hashCode methods which are based on the id.
> 
> 3)   "Session closed" errors trying to fetch associations when we
> are writing objects to the client.   I'm not sure why the current
> "fetchObjectProperties" method is not fetching these objects for some
> people's domain model but if anyone has a test case which can reproduce
> this I'm interested.   It should be walking down all public properties
> and fetching them - the same way that our serialization code is working
> but somehow I must be missing something in the traversal code.  
> 
>  
> 
> There is a public beta coming out fairly soon which will have 1) and 2)
> fixed.   I haven't had a chance to backport these fixes to a version of
> the hibernate assembler which works in 2.0.1 but if there is enough
> demand (and I can find enough time!) I could probably do that.  Of
> course I'd rather get anyone running into trouble on the beta so we can
> make sure that version is solid.
> 
>  
> 
> Jeff
> 
>  
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of simonjpalmer
> Sent: Friday, February 23, 2007 2:47 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: FDS/Hibernate Sample of updating hierarchical
> list of values
> 
>  
> 
> PW, BTW pop over to the FDS forum at Adobe
> 
> http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=60&c
> atid=583
> <http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=60&;
> catid=583> 
> 
> take a look at the thread called 
> 
> "Parent Child Hierarchy with FDS and Hibernate"
> 
> SP
> 
> --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> , "simonjpalmer" 
> wrote:
> >
> > PW and Jeff,
> > 
> > PW, you and I seem to be in the same boat. I am trying to fight off
> > the people who were flex skeptics to start with. Not being able to
> > write data back makes the whole thing look pretty amateur and confirms
> > people's belief that the technology isn't ready - which given this
> > experience it clearly isn't. The baby is definitely at risk of being
> > thrown out with the bath water. It stands in our company simply
> > because I have the final call as Technical Director (CTO if you are in
> > the US).
> > 
> > I am a huge flex advocate and really doing my best to evangelise on
> > the topic. What's more I t

RE: [flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of values

2007-02-23 Thread Jeff Vroom
My apologies for the Hibernate problems y'all have been having.  We do
have a bunch of users happily using this for relatively simple use cases
but as your domain models grow in complexity, you may run into some
problems.

 

Here are the set of problems I currently know about.  

 

1)   unique object exceptions during "updateItem".  The one case
where I know this will happen is if you have hibernate associations
which do not have corresponding FDS associations (i.e. the hierarchical
values).  This should be supported and it turns out that the fix for the
problem is to use hibernate's "merge" method instead of trying to do the
merge by hand as is done in 2.0.1's updateItem method.   The code in
updateItem that is causing the bulk of this problem is the code which
fetches the current server version to do conflict detection.  In doing
that, it creates hibernate instances in the session which may conflict
with instances that get sent in by the client.  Hibernate's "merge"
method takes care of all of this for us.

2)   Domain objects need id/equals test which is based on the id.
Some of the code in the hibernate assembler is using the "equals" method
when it should be comparing the id properties.  You can workaround this
by having equals and hashCode methods which are based on the id.

3)   "Session closed" errors trying to fetch associations when we
are writing objects to the client.   I'm not sure why the current
"fetchObjectProperties" method is not fetching these objects for some
people's domain model but if anyone has a test case which can reproduce
this I'm interested.   It should be walking down all public properties
and fetching them - the same way that our serialization code is working
but somehow I must be missing something in the traversal code.  

 

There is a public beta coming out fairly soon which will have 1) and 2)
fixed.   I haven't had a chance to backport these fixes to a version of
the hibernate assembler which works in 2.0.1 but if there is enough
demand (and I can find enough time!) I could probably do that.  Of
course I'd rather get anyone running into trouble on the beta so we can
make sure that version is solid.

 

Jeff

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of simonjpalmer
Sent: Friday, February 23, 2007 2:47 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: FDS/Hibernate Sample of updating hierarchical
list of values

 

PW, BTW pop over to the FDS forum at Adobe

http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=60&c
atid=583
<http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=60&;
catid=583> 

take a look at the thread called 

"Parent Child Hierarchy with FDS and Hibernate"

SP

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "simonjpalmer" <[EMAIL PROTECTED]>
wrote:
>
> PW and Jeff,
> 
> PW, you and I seem to be in the same boat. I am trying to fight off
> the people who were flex skeptics to start with. Not being able to
> write data back makes the whole thing look pretty amateur and confirms
> people's belief that the technology isn't ready - which given this
> experience it clearly isn't. The baby is definitely at risk of being
> thrown out with the bath water. It stands in our company simply
> because I have the final call as Technical Director (CTO if you are in
> the US).
> 
> I am a huge flex advocate and really doing my best to evangelise on
> the topic. What's more I think that the bridge to operational data is
> the most profound leap forward for flash, it takes it out of the world
> of gimicks and into the world of real business applications. 
> 
> Jeff, you and your and team deserve huge credit for that vision and
> excellent execution.
> 
> However, much as it pains me to say it, the bottom line is that the
> hibernate middle tier provided does not work, as PW and I (and a host
> of other people on various forums) have found. I know that I can
> re-write the whole thing myself and will probably have to, but when
> introducing new technologies it is unfortunately all about initial
> perception. 
> 
> I have made a career of doing this sort of thing myself and I have
> seen excellent projects fail to fly because of low initial quality,
> even though we fixed them immediately, the damage was done because
> people's impression was that they were flaky. I'm sure you know it is
> hard to get back from that first impression and the word of mouth that
> springs from it. Once it becomes entrenched that opinion becomes fact
> and you are irrevocably lost. If I were Adobe I would be a little
> worried about the tone of the posts I am seeing abo

RE: [flexcoders] Re: FDS/Hibernate - LazyInitializationException when writing AMF output

2007-02-23 Thread Eric D Anderson
Hi PW,

 

I'd suggest that we add you to the latest Data Services beta because
either we have fixed this issue, or we will fix this issue in the next
release.  Can you contact me off-list and I'll add you to the beat so
you can test DS with the latest DS and hibernate assembler.

 

Thanks


Eric

 

Flex PM

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of parkerwhirlow
Sent: Friday, February 16, 2007 7:06 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: FDS/Hibernate - LazyInitializationException
when writing AMF output

 

This is happening from FDS... flex.data.assemblers.HibernateAssembler
uses a function called fetchObjectProperties() that's supposed to load
them all while the session is open right?

I've seen in other posts that FDS eager fetches the properties in the
Assembler, so that they are available during serialization... 

am I missing something here?

thanks,
PW

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, Dima Gutzeit <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> You have to initialize the collections before AMF serializes them. The

> problem occurs since you closing Hibernate session without first 
> initializing the arrays, and since you are using lazy initialization
the 
> problem arise.
> 
> You have two options :
> 
> 1. Use lazy=false
> 2. Better one, is calling
/Hibernate.initialize(your_array_reference);/ 
> before you close the Hibernate session.
> 
> Regards,
> Dima Gutzeit.
> 
> parkerwhirlow wrote:
> >
> > Hi again =)
> >
> > I've just started getting this exception inconsistently... sometimes
> > it happens 3 times in a row, other times I can go all afternoon
> > without getting it. Once the exception occurs, it will occur every
> > time the client loads until FDS is restarted.
> >
> > Note this occurs on multiple collections. I tried setting the
> > "offending" collection to lazy=false (in Hibernate), and the
exception
> > occurred on a different collection. I can't set every one of my
> > collections to lazy=false. Especially since at this point, they HAVE
> > to be lazy for the updateItem via hierarchical values to almost
work.
> >
> > I also noticed that the collection does not necessarily need to have
> > any items in it. (And possibly is caused specifically by NOT having
> > any items in it, I can't tell for sure). The collection referenced
in
> > the exception below has no values, and there's another collection in
> > that same class with values that doesn't seem to cause the
exception.
> >
> > See below the hibernate mapping, and exception output when this
> > occurs. (Note there are no FDS managed associations for this
collection)
> >
> > Thanks for any insight you have as to what is causing this.
> >
> > PW
> > _
> >
> > 
> > 
> > 
> > 
> >  > inverse="false"
> > cascade="all-delete-orphan" >
> > 
> > 
> > 
> > 
> > 
> > ...
> > 
> >
> > 10:19:42,093 WARN ProxyWarnLog - Narrowing proxy to class
> > config.test.Adult - this operation breaks ==
> > 10:19:44,687 ERROR LazyInitializationException - failed to lazily
> > initialize a collection of role: config.test.Adult.children, no
> > session or session was closed
> > org.hibernate.LazyInitializationException: failed to lazily
initialize
> > a collection of role: config.test.Adult.children, no session or
> > session was closed
> > at
> >
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializ
ationException(AbstractPersistentCollection.java:358)
> > at
> >
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializ
ationExceptionIfNotConnected(AbstractPersistentCollection.j
> > ava:350)
> > at
> >
org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractP
ersistentCollection.java:97)
> > at
> > org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
> > at java.util.ArrayList.(ArrayList.java:133)
> > at
> > flex.messaging.io.ArrayCollection.(ArrayCollection.java:44)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:40
7)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:147)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:215
)
> > at
> >
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:495)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:46

[flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of values

2007-02-23 Thread simonjpalmer
PW, BTW pop over to the FDS forum at Adobe

http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=60&catid=583

take a look at the thread called 

"Parent Child Hierarchy with FDS and Hibernate"

SP

--- In flexcoders@yahoogroups.com, "simonjpalmer" <[EMAIL PROTECTED]>
wrote:
>
> PW and Jeff,
> 
> PW, you and I seem to be in the same boat.  I am trying to fight off
> the people who were flex skeptics to start with.  Not being able to
> write data back makes the whole thing look pretty amateur and confirms
> people's belief that the technology isn't ready - which given this
> experience it clearly isn't.  The baby is definitely at risk of being
> thrown out with the bath water.  It stands in our company simply
> because I have the final call as Technical Director (CTO if you are in
> the US).
> 
> I am a huge flex advocate and really doing my best to evangelise on
> the topic.  What's more I think that the bridge to operational data is
> the most profound leap forward for flash, it takes it out of the world
> of gimicks and into the world of real business applications.  
> 
> Jeff, you and your and team deserve huge credit for that vision and
> excellent execution.
> 
> However, much as it pains me to say it, the bottom line is that the
> hibernate middle tier provided does not work, as PW and I (and a host
> of other people on various forums) have found.  I know that I can
> re-write the whole thing myself and will probably have to, but when
> introducing new technologies it is unfortunately all about initial
> perception.  
> 
> I have made a career of doing this sort of thing myself and I have
> seen excellent projects fail to fly because of low initial quality,
> even though we fixed them immediately, the damage was done because
> people's impression was that they were flaky.  I'm sure you know it is
> hard to get back from that first impression and the word of mouth that
> springs from it.  Once it becomes entrenched that opinion becomes fact
> and you are irrevocably lost.  If I were Adobe I would be a little
> worried about the tone of the posts I am seeing about integration with
> Hibernate.
> 
> The Hibernate Assembler is very important and I would really hate to
> see that happen to it.  The corollary is very unfortunate.  That
> little bit of technology transform the boardroom conversation about
> FDS.  Suddenly the cost of the licensing of FDS becomes justifiable
> against the dev cost savings because we can just plug into the ORM. 
> Having made that justification myself it is very difficult for me now
> to go back and say, "by the way I also have to incur the dev costs". 
> When asked why? I have to confess that the Adobe code doesn't work and
> we don't know when we're getting a fix.  For the Flex/Flash skeptics
> in the room that's a god send.
> 
> For me it is a complete nightmare.  It is hard for me to separate the
> cost of FDS licenses (which is almost prohibitively large) against the
> cost of dev.  I would urge Jeff and Co to get the Hibernate Assembler
> code watertight and shipping asap.  If I can be of any assistance I
> will gladly offer my services.
> 
> If either of you would like to contact me, post a reply and I will
> happily give you my details.
> 
> Simon Palmer
> Technical Director
> The PMCo
> 62 St Peters Street
> St Albans
> HERTS  AL1 3HG
> UK
> 
> --- In flexcoders@yahoogroups.com, "parkerwhirlow" 
> wrote:
> >
> > Thats very unfortunate. I'm getting farther and farther into hot water
> > not being able to reliably update our data model using Flex.
> > 
> > Last it was "just wait for 2.0.1, there's a lot of Hibernate/FDS fixes
> > in it" and now we're waiting for another unknown amount of time for
> > fixes we can only hope will help our situation.
> > 
> > I'm apologize, I understand it's not your fault, and I really
> > appreciate the insight you provide as to what can be causing our
> > problems, I'm just getting up to my neck in unsolved problems.
> > 
> > If you have any insight as to "roughly" when this next release could
> > occur, can you tip me off?
> > 
> > thanks,
> > PW
> > 
> > --- In flexcoders@yahoogroups.com, "Jeff Vroom"  wrote:
> > >
> > > I have finished making the changes and the use of the "merge" call
> seems
> > > to be a) much simpler and b) more robust than the way the
current code
> > > works.   
> > > 
> > >  
> > > 
> > > Unfortunately we've made enough changes to th

[flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of values

2007-02-23 Thread simonjpalmer
PW and Jeff,

PW, you and I seem to be in the same boat.  I am trying to fight off
the people who were flex skeptics to start with.  Not being able to
write data back makes the whole thing look pretty amateur and confirms
people's belief that the technology isn't ready - which given this
experience it clearly isn't.  The baby is definitely at risk of being
thrown out with the bath water.  It stands in our company simply
because I have the final call as Technical Director (CTO if you are in
the US).

I am a huge flex advocate and really doing my best to evangelise on
the topic.  What's more I think that the bridge to operational data is
the most profound leap forward for flash, it takes it out of the world
of gimicks and into the world of real business applications.  

Jeff, you and your and team deserve huge credit for that vision and
excellent execution.

However, much as it pains me to say it, the bottom line is that the
hibernate middle tier provided does not work, as PW and I (and a host
of other people on various forums) have found.  I know that I can
re-write the whole thing myself and will probably have to, but when
introducing new technologies it is unfortunately all about initial
perception.  

I have made a career of doing this sort of thing myself and I have
seen excellent projects fail to fly because of low initial quality,
even though we fixed them immediately, the damage was done because
people's impression was that they were flaky.  I'm sure you know it is
hard to get back from that first impression and the word of mouth that
springs from it.  Once it becomes entrenched that opinion becomes fact
and you are irrevocably lost.  If I were Adobe I would be a little
worried about the tone of the posts I am seeing about integration with
Hibernate.

The Hibernate Assembler is very important and I would really hate to
see that happen to it.  The corollary is very unfortunate.  That
little bit of technology transform the boardroom conversation about
FDS.  Suddenly the cost of the licensing of FDS becomes justifiable
against the dev cost savings because we can just plug into the ORM. 
Having made that justification myself it is very difficult for me now
to go back and say, "by the way I also have to incur the dev costs". 
When asked why? I have to confess that the Adobe code doesn't work and
we don't know when we're getting a fix.  For the Flex/Flash skeptics
in the room that's a god send.

For me it is a complete nightmare.  It is hard for me to separate the
cost of FDS licenses (which is almost prohibitively large) against the
cost of dev.  I would urge Jeff and Co to get the Hibernate Assembler
code watertight and shipping asap.  If I can be of any assistance I
will gladly offer my services.

If either of you would like to contact me, post a reply and I will
happily give you my details.

Simon Palmer
Technical Director
The PMCo
62 St Peters Street
St Albans
HERTS  AL1 3HG
UK

--- In flexcoders@yahoogroups.com, "parkerwhirlow" <[EMAIL PROTECTED]>
wrote:
>
> Thats very unfortunate. I'm getting farther and farther into hot water
> not being able to reliably update our data model using Flex.
> 
> Last it was "just wait for 2.0.1, there's a lot of Hibernate/FDS fixes
> in it" and now we're waiting for another unknown amount of time for
> fixes we can only hope will help our situation.
> 
> I'm apologize, I understand it's not your fault, and I really
> appreciate the insight you provide as to what can be causing our
> problems, I'm just getting up to my neck in unsolved problems.
> 
> If you have any insight as to "roughly" when this next release could
> occur, can you tip me off?
> 
> thanks,
> PW
> 
> --- In flexcoders@yahoogroups.com, "Jeff Vroom"  wrote:
> >
> > I have finished making the changes and the use of the "merge" call
seems
> > to be a) much simpler and b) more robust than the way the current code
> > works.   
> > 
> >  
> > 
> > Unfortunately we've made enough changes to the code surrounding the
> > HibernateAssembler so I can't just send you the updated file and
have it
> > work in FDS2.  It will be in an upcoming public beta but I don't think
> > we've announced the dates on that.  
> > 
> >  
> > 
> > Jeff
> > 
> >  
> > 
> > 
> > 
> > From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On
> > Behalf Of parkerwhirlow
> > Sent: Thursday, February 15, 2007 3:29 PM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Re: FDS/Hibernate Sample of updating
hierarchical
> > list of values
> > 
> >  
> > 
> > Hey Jeff, just curious if you've go

RE: [flexcoders] Re: FDS/Hibernate - LazyInitializationException when writing AMF output

2007-02-18 Thread Jeff Vroom
The HibernateAssembler uses the "fetchObjectProperties" method to walk
down the object graph of data that will be serialized to the client.  It
calls this while the session is open so that it can be sure to fetch
everything that will be serialized.  There must be a bug in this method
which is preventing it from fetching all of the state in one of your
objects.It stops if it is a lazy="true" association property.  For
non-association properties, it goes recursively down the property tree
(keeping track of objects it has visited to avoid cycles).   The
algorithm is trying to mimic the path taken by our serialization code
but when the session is open but without the memory overhead of
serializing the data.

 

I thought the code was handling the types of collections and stuff that
hibernate can handle but maybe I'm missing something?   I'll look at the
serialization code to try and figure out what is different.  In the
meantime, your domain model has some state which is just not being
fetched.  You can override the HibernateAssember's fetchObjectProperties
method (you'll unfortunately need to copy the source and change the
package name since this is currently private) to "touch" the objects
needed (just call the getX method or whatever).  In this case it is
trying to fetch an object of type: "config.test.Adult.children" but that
is not telling us which path it is taking to hit that type
unfortunately.  If you can figure out the path, just put the calls e.g.
getChildren into your fetchObjectProperties method.  

 

Jeff

 

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Carlos Rovira
Sent: Sunday, February 18, 2007 3:19 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: FDS/Hibernate -
LazyInitializationException when writing AMF output

 

I found that error when some complex object graph return to FDS and FDS
can't deal with that complex object, so throws that huge error stack. I
solve it returning a more simple object or String.

Hope that helps... 



On 2/17/07, parkerwhirlow <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

This is happening from FDS... flex.data.assemblers.HibernateAssembler
uses a function called fetchObjectProperties() that's supposed to load
them all while the session is open right?

I've seen in other posts that FDS eager fetches the properties in the
Assembler, so that they are available during serialization... 

am I missing something here?

thanks,
PW



--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, Dima Gutzeit <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> You have to initialize the collections before AMF serializes them. The

> problem occurs since you closing Hibernate session without first 
> initializing the arrays, and since you are using lazy initialization
the 
> problem arise.
> 
> You have two options :
> 
> 1. Use lazy=false
> 2. Better one, is calling
/Hibernate.initialize(your_array_reference);/ 
> before you close the Hibernate session.
> 
> Regards,
> Dima Gutzeit.
> 
> parkerwhirlow wrote:
> >
> > Hi again =)
> >
> > I've just started getting this exception inconsistently... sometimes
> > it happens 3 times in a row, other times I can go all afternoon
> > without getting it. Once the exception occurs, it will occur every
> > time the client loads until FDS is restarted.
> >
> > Note this occurs on multiple collections. I tried setting the
> > "offending" collection to lazy=false (in Hibernate), and the
exception
> > occurred on a different collection. I can't set every one of my
> > collections to lazy=false. Especially since at this point, they HAVE
> > to be lazy for the updateItem via hierarchical values to almost
work.
> >
> > I also noticed that the collection does not necessarily need to have
> > any items in it. (And possibly is caused specifically by NOT having
> > any items in it, I can't tell for sure). The collection referenced
in
> > the exception below has no values, and there's another collection in
> > that same class with values that doesn't seem to cause the
exception.
> >
> > See below the hibernate mapping, and exception output when this
> > occurs. (Note there are no FDS managed associations for this
collection)
> >
> > Thanks for any insight you have as to what is causing this.
> >
> > PW
> > _
> >
> > 
> > 
> > 
> > 
> >  > inverse="false"
> > cascade="all-delete-orphan" >
> > 
> > 
> > 
> > 
> > 
> > ...
> > 

Re: [flexcoders] Re: FDS/Hibernate - LazyInitializationException when writing AMF output

2007-02-18 Thread Carlos Rovira

I found that error when some complex object graph return to FDS and FDS
can't deal with that complex object, so throws that huge error stack. I
solve it returning a more simple object or String.

Hope that helps...


On 2/17/07, parkerwhirlow <[EMAIL PROTECTED]> wrote:


  This is happening from FDS... flex.data.assemblers.HibernateAssembler
uses a function called fetchObjectProperties() that's supposed to load
them all while the session is open right?

I've seen in other posts that FDS eager fetches the properties in the
Assembler, so that they are available during serialization...

am I missing something here?

thanks,
PW


--- In flexcoders@yahoogroups.com , Dima
Gutzeit <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> You have to initialize the collections before AMF serializes them. The
> problem occurs since you closing Hibernate session without first
> initializing the arrays, and since you are using lazy initialization
the
> problem arise.
>
> You have two options :
>
> 1. Use lazy=false
> 2. Better one, is calling /Hibernate.initialize(your_array_reference);/
> before you close the Hibernate session.
>
> Regards,
> Dima Gutzeit.
>
> parkerwhirlow wrote:
> >
> > Hi again =)
> >
> > I've just started getting this exception inconsistently... sometimes
> > it happens 3 times in a row, other times I can go all afternoon
> > without getting it. Once the exception occurs, it will occur every
> > time the client loads until FDS is restarted.
> >
> > Note this occurs on multiple collections. I tried setting the
> > "offending" collection to lazy=false (in Hibernate), and the exception
> > occurred on a different collection. I can't set every one of my
> > collections to lazy=false. Especially since at this point, they HAVE
> > to be lazy for the updateItem via hierarchical values to almost work.
> >
> > I also noticed that the collection does not necessarily need to have
> > any items in it. (And possibly is caused specifically by NOT having
> > any items in it, I can't tell for sure). The collection referenced in
> > the exception below has no values, and there's another collection in
> > that same class with values that doesn't seem to cause the exception.
> >
> > See below the hibernate mapping, and exception output when this
> > occurs. (Note there are no FDS managed associations for this
collection)
> >
> > Thanks for any insight you have as to what is causing this.
> >
> > PW
> > _
> >
> > 
> > 
> > 
> > 
> >  > inverse="false"
> > cascade="all-delete-orphan" >
> > 
> > 
> > 
> > 
> > 
> > ...
> > 
> >
> > 10:19:42,093 WARN ProxyWarnLog - Narrowing proxy to class
> > config.test.Adult - this operation breaks ==
> > 10:19:44,687 ERROR LazyInitializationException - failed to lazily
> > initialize a collection of role: config.test.Adult.children, no
> > session or session was closed
> > org.hibernate.LazyInitializationException: failed to lazily initialize
> > a collection of role: config.test.Adult.children, no session or
> > session was closed
> > at
> >

org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException
(AbstractPersistentCollection.java:358)
> > at
> >

org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected
(AbstractPersistentCollection.j
> > ava:350)
> > at
> >
org.hibernate.collection.AbstractPersistentCollection.readSize(
AbstractPersistentCollection.java:97)
> > at
> > org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
> > at java.util.ArrayList.(ArrayList.java:133)
> > at
> > flex.messaging.io.ArrayCollection.(ArrayCollection.java:44)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:407)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:147)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:215)
> > at
> >
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:495)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:467)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:165)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObjectArray(Amf3Output.java:730)
> > at
> > flex.messaging.io.amf.Amf3Output.writeAMFArray(Amf3Output.java:386)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:151)
> > at
> >
flex.messaging.io.ArrayCollection.writeExternal(ArrayCollection.java:97)
> > at
> >
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:485)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:414)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:147)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:215)
> > at
> >
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:495)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:467)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3

[flexcoders] Re: FDS/Hibernate - LazyInitializationException when writing AMF output

2007-02-16 Thread parkerwhirlow
This is happening from FDS... flex.data.assemblers.HibernateAssembler
uses a function called fetchObjectProperties() that's supposed to load
them all while the session is open right?

I've seen in other posts that FDS eager fetches the properties in the
Assembler, so that they are available during serialization... 

am I missing something here?

thanks,
PW



--- In flexcoders@yahoogroups.com, Dima Gutzeit <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> You have to initialize the collections before AMF serializes them. The 
> problem occurs since you closing Hibernate session without first 
> initializing the arrays, and since you are using lazy initialization
the 
> problem arise.
> 
> You have two options :
> 
> 1. Use lazy=false
> 2. Better one, is calling /Hibernate.initialize(your_array_reference);/ 
> before you close the Hibernate session.
> 
> Regards,
> Dima Gutzeit.
> 
> parkerwhirlow wrote:
> >
> > Hi again =)
> >
> > I've just started getting this exception inconsistently... sometimes
> > it happens 3 times in a row, other times I can go all afternoon
> > without getting it. Once the exception occurs, it will occur every
> > time the client loads until FDS is restarted.
> >
> > Note this occurs on multiple collections. I tried setting the
> > "offending" collection to lazy=false (in Hibernate), and the exception
> > occurred on a different collection. I can't set every one of my
> > collections to lazy=false. Especially since at this point, they HAVE
> > to be lazy for the updateItem via hierarchical values to almost work.
> >
> > I also noticed that the collection does not necessarily need to have
> > any items in it. (And possibly is caused specifically by NOT having
> > any items in it, I can't tell for sure). The collection referenced in
> > the exception below has no values, and there's another collection in
> > that same class with values that doesn't seem to cause the exception.
> >
> > See below the hibernate mapping, and exception output when this
> > occurs. (Note there are no FDS managed associations for this
collection)
> >
> > Thanks for any insight you have as to what is causing this.
> >
> > PW
> > _
> >
> > 
> > 
> > 
> > 
> >  > inverse="false"
> > cascade="all-delete-orphan" >
> > 
> > 
> > 
> > 
> > 
> > ...
> > 
> >
> > 10:19:42,093 WARN ProxyWarnLog - Narrowing proxy to class
> > config.test.Adult - this operation breaks ==
> > 10:19:44,687 ERROR LazyInitializationException - failed to lazily
> > initialize a collection of role: config.test.Adult.children, no
> > session or session was closed
> > org.hibernate.LazyInitializationException: failed to lazily initialize
> > a collection of role: config.test.Adult.children, no session or
> > session was closed
> > at
> >
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> > at
> >
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.j
> > ava:350)
> > at
> >
org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
> > at
> > org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
> > at java.util.ArrayList.(ArrayList.java:133)
> > at
> > flex.messaging.io.ArrayCollection.(ArrayCollection.java:44)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:407)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:147)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:215)
> > at
> >
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:495)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:467)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:165)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObjectArray(Amf3Output.java:730)
> > at
> > flex.messaging.io.amf.Amf3Output.writeAMFArray(Amf3Output.java:386)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:151)
> > at
> >
flex.messaging.io.ArrayCollection.writeExternal(ArrayCollection.java:97)
> > at
> >
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:485)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:414)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:147)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:215)
> > at
> >
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:495)
> > at
> >
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:467)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:165)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObjectArray(Amf3Output.java:730)
> > at
> > flex.messaging.io.amf.Amf3Output.writeAMFArray(Amf3Output.java:386)
> > at
> > flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:151)
> > at
> >
flex

[flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of values

2007-02-16 Thread parkerwhirlow
Thats very unfortunate. I'm getting farther and farther into hot water
not being able to reliably update our data model using Flex.

Last it was "just wait for 2.0.1, there's a lot of Hibernate/FDS fixes
in it" and now we're waiting for another unknown amount of time for
fixes we can only hope will help our situation.

I'm apologize, I understand it's not your fault, and I really
appreciate the insight you provide as to what can be causing our
problems, I'm just getting up to my neck in unsolved problems.

If you have any insight as to "roughly" when this next release could
occur, can you tip me off?

thanks,
PW

--- In flexcoders@yahoogroups.com, "Jeff Vroom" <[EMAIL PROTECTED]> wrote:
>
> I have finished making the changes and the use of the "merge" call seems
> to be a) much simpler and b) more robust than the way the current code
> works.   
> 
>  
> 
> Unfortunately we've made enough changes to the code surrounding the
> HibernateAssembler so I can't just send you the updated file and have it
> work in FDS2.  It will be in an upcoming public beta but I don't think
> we've announced the dates on that.  
> 
>  
> 
> Jeff
> 
>  
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of parkerwhirlow
> Sent: Thursday, February 15, 2007 3:29 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: FDS/Hibernate Sample of updating hierarchical
> list of values
> 
>  
> 
> Hey Jeff, just curious if you've got any updated HibernateAssembler
> code with some fixes? Any idea when this would be available?
> 
> thanks,
> PW
> 
> --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> , "Jeff Vroom"  wrote:
> >
> > My apologies - this does look like a bug. I need to do more testing on
> > this case myself, but I think one of the big problems here is that we
> > are trying to do conflict detection on our own in the hibernate
> > assembler's updateItem method. Unless you are using a strict isolation
> > level in your DB (repeatable read or serializable) this is not going
> to
> > be transactionally correct anyway since the DB version can be modified
> > after we have executed the query and before we do our update. We
> > probably should not be getting the server version at all... hibernate
> > has its own optimistic concurrency support that we should be using if
> it
> > is enabled. That is probably the only way to get atomic conflict
> > detection without resorting to using those particularly slow isolation
> > levels. 
> > 
> > 
> > 
> > That would potentially get rid of the conflicting version of the item
> in
> > the transaction. The other thing I need to look into is the "merge"
> > method in hibernate. Seems like we should probably be using that in
> the
> > updateItem method? I'll be working on this next week so will send out
> > any updates I can to the code.
> > 
> > 
> > 
> > Jeff
> > 
> > 
> > 
> > 
> > 
> > From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of parkerwhirlow
> > Sent: Thursday, February 01, 2007 6:05 PM
> > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> > Subject: [flexcoders] FDS/Hibernate Sample of updating hierarchical
> list
> > of values
> > 
> > 
> > 
> > 
> > Hi all,
> > 
> > I have been tearing my hair out trying to get FDS/Hibernate to update
> > a hierarchical list of values. Even the simplest of collection
> > mappings in Hibernate cause various exceptions when trying to update.
> > 
> > Before I post my details, does anyone have any examples of this that
> > work? Has anyone ever even gotten this to work?
> > 
> > I have two objects mapped in Hibernate:
> > 
> > - Family
> > Person
> > 
> > where a Family has a Set of Person "familyMembers".
> > 
> > My FDS destination is to Family, and I am trying to update a family
> > member (just the name) through this destination.
> > 
> > First, I was getting Hibernate NonUniqueObjectException, which I
> > finally tracked down to having my hibernate collection mapping set to
> > lazy=false This caused all of the family member Person objects to be
> > loaded into the PersistenceContext when the HibernateAssembler lo

RE: [flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of values

2007-02-15 Thread Jeff Vroom
I have finished making the changes and the use of the "merge" call seems
to be a) much simpler and b) more robust than the way the current code
works.   

 

Unfortunately we've made enough changes to the code surrounding the
HibernateAssembler so I can't just send you the updated file and have it
work in FDS2.  It will be in an upcoming public beta but I don't think
we've announced the dates on that.  

 

Jeff

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of parkerwhirlow
Sent: Thursday, February 15, 2007 3:29 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: FDS/Hibernate Sample of updating hierarchical
list of values

 

Hey Jeff, just curious if you've got any updated HibernateAssembler
code with some fixes? Any idea when this would be available?

thanks,
PW

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Jeff Vroom" <[EMAIL PROTECTED]> wrote:
>
> My apologies - this does look like a bug. I need to do more testing on
> this case myself, but I think one of the big problems here is that we
> are trying to do conflict detection on our own in the hibernate
> assembler's updateItem method. Unless you are using a strict isolation
> level in your DB (repeatable read or serializable) this is not going
to
> be transactionally correct anyway since the DB version can be modified
> after we have executed the query and before we do our update. We
> probably should not be getting the server version at all... hibernate
> has its own optimistic concurrency support that we should be using if
it
> is enabled. That is probably the only way to get atomic conflict
> detection without resorting to using those particularly slow isolation
> levels. 
> 
> 
> 
> That would potentially get rid of the conflicting version of the item
in
> the transaction. The other thing I need to look into is the "merge"
> method in hibernate. Seems like we should probably be using that in
the
> updateItem method? I'll be working on this next week so will send out
> any updates I can to the code.
> 
> 
> 
> Jeff
> 
> 
> 
> 
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of parkerwhirlow
> Sent: Thursday, February 01, 2007 6:05 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] FDS/Hibernate Sample of updating hierarchical
list
> of values
> 
> 
> 
> 
> Hi all,
> 
> I have been tearing my hair out trying to get FDS/Hibernate to update
> a hierarchical list of values. Even the simplest of collection
> mappings in Hibernate cause various exceptions when trying to update.
> 
> Before I post my details, does anyone have any examples of this that
> work? Has anyone ever even gotten this to work?
> 
> I have two objects mapped in Hibernate:
> 
> - Family
> Person
> 
> where a Family has a Set of Person "familyMembers".
> 
> My FDS destination is to Family, and I am trying to update a family
> member (just the name) through this destination.
> 
> First, I was getting Hibernate NonUniqueObjectException, which I
> finally tracked down to having my hibernate collection mapping set to
> lazy=false This caused all of the family member Person objects to be
> loaded into the PersistenceContext when the HibernateAssembler loaded
> the "serverVersion" of the Family. 
> 
> Then, once I set lazy=true on the collection mapping, I was getting an
> exception that "A collection with cascade="all-delete-orphan" was no
> longer referenced by the owning entity instance"... since it is
> assigning a whole new collection to the familyMembers property one
> becomes unreferenced, and the other referenced. Sooo I can't use
> delete orphan to delete the family members when the family is
> deleted... OK. So then I make cascade="all".
> 
> Now I'm getting "ORA-01407: cannot update
> ("SCHEMA"."T_PERSON"."FAMILYID") to NULL"... I'm guessing that it's
> processing the dereferenced collection first (trying to detatch any
> Person's from the family before they're re-attached by the new
> collection. I can't believe this is so difficult...
> 
> For more info on my setup and test case, please see my original post:
> http://tech.groups.yahoo.com/group/flexcoders/message/63308
<http://tech.groups.yahoo.com/group/flexcoders/message/63308> 
> <http://tech.groups.yahoo.com/group/flexcoders/message/63308
<http://tech.groups.yahoo.com/group/flexcoders/message/63308> > 
> 
> any comments as to if anyone has done this successfully are greatly
> appreciated!
> 
> thanks,
> PW
>

 



[flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of values

2007-02-15 Thread parkerwhirlow
Hey Jeff, just curious if you've got any updated HibernateAssembler
code with some fixes? Any idea when this would be available?

thanks,
PW

--- In flexcoders@yahoogroups.com, "Jeff Vroom" <[EMAIL PROTECTED]> wrote:
>
> My apologies - this does look like a bug.   I need to do more testing on
> this case myself, but I think one of the big problems here is that we
> are trying to do conflict detection on our own in the hibernate
> assembler's updateItem method.  Unless you are using a strict isolation
> level in your DB (repeatable read or serializable) this is not going to
> be transactionally correct anyway since the DB version can be modified
> after we have executed the query and before we do our update.   We
> probably should not be getting the server version at all... hibernate
> has its own optimistic concurrency support that we should be using if it
> is enabled.   That is probably the only way to get atomic conflict
> detection without resorting to using those particularly slow isolation
> levels.  
> 
>  
> 
> That would potentially get rid of the conflicting version of the item in
> the transaction.  The other thing I need to look into is the "merge"
> method in hibernate.  Seems like we should probably be using that in the
> updateItem method?   I'll be working on this next week so will send out
> any updates I can to the code.
> 
>  
> 
> Jeff
> 
>  
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of parkerwhirlow
> Sent: Thursday, February 01, 2007 6:05 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] FDS/Hibernate Sample of updating hierarchical list
> of values
> 
>  
> 
> 
> Hi all,
> 
> I have been tearing my hair out trying to get FDS/Hibernate to update
> a hierarchical list of values. Even the simplest of collection
> mappings in Hibernate cause various exceptions when trying to update.
> 
> Before I post my details, does anyone have any examples of this that
> work? Has anyone ever even gotten this to work?
> 
> I have two objects mapped in Hibernate:
> 
> - Family
> Person
> 
> where a Family has a Set of Person "familyMembers".
> 
> My FDS destination is to Family, and I am trying to update a family
> member (just the name) through this destination.
> 
> First, I was getting Hibernate NonUniqueObjectException, which I
> finally tracked down to having my hibernate collection mapping set to
> lazy=false This caused all of the family member Person objects to be
> loaded into the PersistenceContext when the HibernateAssembler loaded
> the "serverVersion" of the Family. 
> 
> Then, once I set lazy=true on the collection mapping, I was getting an
> exception that "A collection with cascade="all-delete-orphan" was no
> longer referenced by the owning entity instance"... since it is
> assigning a whole new collection to the familyMembers property one
> becomes unreferenced, and the other referenced. Sooo I can't use
> delete orphan to delete the family members when the family is
> deleted... OK. So then I make cascade="all".
> 
> Now I'm getting "ORA-01407: cannot update
> ("SCHEMA"."T_PERSON"."FAMILYID") to NULL"... I'm guessing that it's
> processing the dereferenced collection first (trying to detatch any
> Person's from the family before they're re-attached by the new
> collection. I can't believe this is so difficult...
> 
> For more info on my setup and test case, please see my original post:
> http://tech.groups.yahoo.com/group/flexcoders/message/63308
>  
> 
> any comments as to if anyone has done this successfully are greatly
> appreciated!
> 
> thanks,
> PW
>




RE: [flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of values

2007-02-05 Thread Jeff Vroom
Yeah, I picked up that change last week.  Sorry we did not find it in
time for 2.0.1 (it was frozen by the time I saw your bug).  Thanks for
catching that problem.  

 

Jeff

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of parkerwhirlow
Sent: Friday, February 02, 2007 8:26 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: FDS/Hibernate Sample of updating hierarchical
list of values

 

Jeff, thanks for looking into this...

while you're at it, I posted this as a bug to the "wishlist" site, but
it didn't make it into 2.0.1... I've taken to building the
HibernateAssembler myself to try to get things working, but this is
dedfinitely a defect:

HibernateAssembler.java (fds2.0.1 release version)
Line (starting): 691

int k;
for (k = i; k < toList.size(); k++)
{
if (assocType.getIdentityFromItem(toList.get(i)).equals(fromId))
break;
}

Notice that the index used in the loop is (i) not (k)... this was
causing some really odd behavior that took me a good while to figure
out =)

thanks again,
PW

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Jeff Vroom" <[EMAIL PROTECTED]> wrote:
>
> My apologies - this does look like a bug. I need to do more testing on
> this case myself, but I think one of the big problems here is that we
> are trying to do conflict detection on our own in the hibernate
> assembler's updateItem method. Unless you are using a strict isolation
> level in your DB (repeatable read or serializable) this is not going
to
> be transactionally correct anyway since the DB version can be modified
> after we have executed the query and before we do our update. We
> probably should not be getting the server version at all... hibernate
> has its own optimistic concurrency support that we should be using if
it
> is enabled. That is probably the only way to get atomic conflict
> detection without resorting to using those particularly slow isolation
> levels. 
> 
> 
> 
> That would potentially get rid of the conflicting version of the item
in
> the transaction. The other thing I need to look into is the "merge"
> method in hibernate. Seems like we should probably be using that in
the
> updateItem method? I'll be working on this next week so will send out
> any updates I can to the code.
> 
> 
> 
> Jeff
> 

 



[flexcoders] Re: FDS/Hibernate Sample of updating hierarchical list of values

2007-02-02 Thread parkerwhirlow
Jeff, thanks for looking into this...

while you're at it, I posted this as a bug to the "wishlist" site, but
it didn't make it into 2.0.1... I've taken to building the
HibernateAssembler myself to try to get things working, but this is
dedfinitely a defect:

HibernateAssembler.java (fds2.0.1 release version)
Line (starting): 691

int k;
for (k = i; k < toList.size(); k++)
{
  if (assocType.getIdentityFromItem(toList.get(i)).equals(fromId))
  break;
}

Notice that the index used in the loop is (i) not (k)... this was
causing some really odd behavior that took me a good while to figure
out =)

thanks again,
PW


--- In flexcoders@yahoogroups.com, "Jeff Vroom" <[EMAIL PROTECTED]> wrote:
>
> My apologies - this does look like a bug.   I need to do more testing on
> this case myself, but I think one of the big problems here is that we
> are trying to do conflict detection on our own in the hibernate
> assembler's updateItem method.  Unless you are using a strict isolation
> level in your DB (repeatable read or serializable) this is not going to
> be transactionally correct anyway since the DB version can be modified
> after we have executed the query and before we do our update.   We
> probably should not be getting the server version at all... hibernate
> has its own optimistic concurrency support that we should be using if it
> is enabled.   That is probably the only way to get atomic conflict
> detection without resorting to using those particularly slow isolation
> levels.  
> 
>  
> 
> That would potentially get rid of the conflicting version of the item in
> the transaction.  The other thing I need to look into is the "merge"
> method in hibernate.  Seems like we should probably be using that in the
> updateItem method?   I'll be working on this next week so will send out
> any updates I can to the code.
> 
>  
> 
> Jeff
> 




[flexcoders] Re: FDS + Hibernate exception committing updates

2006-08-23 Thread thunderstumpgesatwork
Hi Jeff,

I am not using the version or timestamp features of hibernate, however
I am using the cascade="all" feature to manage sets of child objects
off of the main managed object. In fact, it is this collection of
child objects that has changed (removed one, added one, etc.)

Should the "transitive persistence" work correctly using cascade="all"
? Could this be part of the cause of the conflict?

Also, setting NONE has
fixed the conflict issue, and with it the closed session exception.

If you were to send me those fixes, how difficult would it be for me
to encorporate them into my version of FDS? Do I need to build the
entire project? I have not done so before, but if needed, and I should
have all the source necessary, I'm comfortable attempting it.

thanks,
Thunder

--- In flexcoders@yahoogroups.com, "Jeff Vroom" <[EMAIL PROTECTED]> wrote:
>
> Are you using either the "version" or "timestamp" features of hibernate?
> This causes improper conflicts to be detected in the GMC version (though
> we have fixed this already in house).  To workaround that problem, you
> can turn off conflict detection:
> 
>  
> 
> NONE
> 
>  
> 
> in your destination's  tag.   If that is not a suitable
> workaround, let me know.   We distribute the HibernateAssembler source
> so I could send you a version with the fix in it.
> 
>  
> 
> I may also see the problem with the lazy initialization exception...
> there is code in the hibernate assembler which goes through and does a
> "deep fetch" of all properties which are not lazy="true" associations in
> FDS's configuration.  Hibernate by default has all of its properties
> marked with its own setting of lazy="true" which means that those
> properties are not fetched when the parent object is fetched.  Since we
> need to serialize the state of all non-lazy properties and do not want
> to keep the hibernate session open for this process, we do this deep
> fetch ahead of time to be sure the state will be available for sending
> to the client.  Unfortunately, when we are throwing a DataSyncException
> for the conflict we are not doing the fetch of the object properties for
> the "serverVersion" of the object which also gets sent back to the
> client.  If my theory is correct, this error will go away when the
> conflict goes away but of course it still needs to be fixed.   I just
> made this fix locally so I could send that along as well.  
> 
>  
> 
> Jeff
> 
>  
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Thunder Stumpges
> Sent: Wednesday, August 23, 2006 6:05 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] FDS + Hibernate exception committing updates
> 
>  
> 
> Hi all,
> 
> I have loaded a collection of managed objects, made some changes to
> one of them, and called the DataService.commit() to commit these
> changes back to the database.
> 
> My DataService is connected to a HibernateAssembler destination, and
> this destination worked to create the initial version of the objects,
> however when I attempt to update them, I get this exception. I can
> tell there was a data sync conflict (not sure why, I'm only using one
> client, one session, one update to the object). However what concerns
> me more is that it's attempting to do something afterwards, and I get
> this Hibernate exception about the session being closed. Any ideas?
> thanks in advance,
> Thunder
> -
> 
> [Flex] 17:17:47.860 [DEBUG] [DataService.General] DataSyncException
> processing message: Flex Message (flex.data.messages.DataMessage)
> operation = update
> id = ASObject(8582034){id=1156377452946003871262}
> clientId = BBE8D031-993E-E344-F36B-3D89CE3F5AE7
> correlationId = B51D63E2-AC1F-9B5F-4554-3D8A2A895B15
> destination = Dashboard
> messageId = 215422DE-07CE-6AB4-21AF-3D8A07CE87DF
> timestamp = 1156378667672
> timeToLive = 0
> body =
> [
> 
> [
> visualizations
> ],
> [EMAIL PROTECTED],
> [EMAIL PROTECTED]
> ]
> hdr(DSEndpoint) = my-rtmp
> exception: flex.data.DataSyncException: Data Synchronization Conflict
> conflictCause: Flex Message (flex.data.messages.DataMessage)
> operation = update
> id = ASObject(8582034){id=1156377452946003871262}
> clientId = BBE8D031-993E-E344-F36B-3D89CE3F5AE7
> correlationId = B51D63E2-AC1F-9B5F-4554-3D8A2A895B15
> destination = Dashboard
> messageId = 215422DE-07CE-6AB4-21AF-3D8A07CE87DF
> timestamp = 1156378667672
> timeToLive = 0
> body =
> [
> 
> [
> visualizations
> ],
> [EMAIL PROTECTED],
> [EMAIL PROTECTED]
> ]
> hdr(DSEndpoint) = my-rtmp
> serverObject: [EMAIL PROTECTED]
> propertyNames: [visualizations]
> at
> flex.data.assemblers.HibernateAssembler.updateItem(HibernateAssembler.ja
> va:713)
> at flex.data.adapters.JavaAdapter.doUpdateItem(JavaAdapter.java:504)
> at
> flex.data.adapters.JavaAdapter.invokeAssemblerSync(JavaAdapter.java:391)
> at
> flex.data.adapters.JavaAdapter.invokeBatchOperation(JavaAdapter.java:248
> )
> at flex.data.adapters.Jav

Re: [flexcoders] Re: FDS & Hibernate

2006-04-18 Thread sobluesky





gr8 idea, why do u have to use 
Adobe's framework? U can create 1 by urself which will be light and 
flexible.
 




sobluesky
2006-04-19



发件人: 
box110a
发送时间: 
2006-04-17 22:36:05
收件人: 
flexcoders@yahoogroups.com
抄送: 
主题: [flexcoders] Re: FDS 
& Hibernate
 

I  the  FDS  Hibernate  Adaptor  will  be 
 a  hard  sell  to  the  Java 
 community.
Aspect  Oriented  Programming  (AOP)  is  the 
 latest  programming  buzzword,
but  it  has  come  about  because  coders 
 want  to  write  plain  old  java
objects  (POJOs),  and  have  a  framework 
 interject  them  where  they  are
needed.  This  has  proven  very  flexible...I 
 am  able  to  use  the  same
POJOS  within  the  Spring  Framework,  Hibernate, 
 my  JSPs  or  a  swing  app.    
 
We're  using  Java  5.  This  means  we 
 can  use  Hibernate  Annotations  to
define  our  ORM  layer.  After  working 
 with  EJBs  without  EJBGen  and  then
working  with  it,  Annotations  save  so 
 much  time  and  headache,  I  won't
use  XML  descriptor  files.    The  problem 
 with  FDS  hibernate  adaptor  is
that  if  I  want  to  use  Annotations, 
 I  have  to  wait  for  Adobe  to 
 release
a  version  that  supports  it.  Another 
 problem  is  that  I  am  tying  my
persistance  layer  so  closely  to  FDS,  I 
 can  only  use  FDS  to  access  it.
What  happens  if  there  is  some  critical 
 bug  in  Hibernate  that  needs  to
be  fixed.  I  have  to  wait  for 
 Adobe  to  release  it  even  though 
 the
Hibernate  team  has  fixed  it.
 
If  you've  gotten  this  far,  thanks  for 
 reading.
-JB
 
 
 
 
---  In  flexcoders@yahoogroups.com,  Valy  Sivec 
  <[EMAIL PROTECTED] >  wrote:
>
>  My  understanding  is  that  with  FDS 
 at  this  moment  you  shouldn't  write
any  DAO  code  and  just  the  mapping 
 files  should  suffice.  On  the  other
hand,  are  Hibernate  features  that  I 
 don't  see  how  to  implement  them
with  the  current  Hibernate  adapter;  might 
 be  just  me...
>      Anyway,  I  have  chosen  to 
 use  Java-JDO  with  Hibernate  &  Spring 
 and
feel  more  comfortable  about  fixing  the 
 bugs  in  the  code  I  can  open
than  having  the  bug  in  the  Hibernate 
 adapter.  In  addition  to  that
historicaly  speaking,  I  haven't  seen  any 
 BUG  fixes  or  patches  to  the
Flex  1.5  and  having  the  bugs  fixed 
 only  via  Flex  Support  seems  to  me 
 a
little  bit  odd.  That  makes  me  even 
 more  reluctant  to  adopt  Hibernate
Adapter.  I  hope  that  in  the  future 
 Adobe  will  release  the  bug  fixes 
 in
patches  available  for  everybody.
>        
>      Thanks,
>      Valy
>        
>        
>      
>  [EMAIL PROTECTED]  wrote:
>      Yep,  just  curious  what 
 functionality  Hibernate  adapter  provides,  
>  using  of  java-dao  adapter  should 
 work  fine  with  Hibernate-based
applications
>  tho  ;)  
>  
>  Regards,
>  Alex  
>  
>  -Original  Message-
>  From:  flexcoders@yahoogroups.com 
 [mailto:[EMAIL PROTECTED]  On
>  Behalf  Of  Matt  Chotin
>  Sent:  Monday,  April  17,  2006  2:35 
 AM
>  To:  flexcoders@yahoogroups.com
>  Subject:  RE:  [flexcoders]  FDS  & 
 Hibernate
>  
>  I  don't  know  that  I  agree 
 with  your  premise  that  open  source  is 
 the
only  way
>  to  understand  a  technology  to 
 adopt  it,  but  agree  that  the
documentation  is
>  behind  the  implementations.  Hopefully 
 when  B3  comes  out  more
documentation
>  will  be  available,  and  the  changes 
 that  we  made  to  the
implementation  should
>  allow  you  to  use  Hibernate  with 
 much  less  FDS  configuration.
>  
>  
>  
>  Matt
>  
>  
>  
>  
>  
>  From:  flexcoders@yahoogroups.com 
 [mailto:[EMAIL PROTECTED]  On
>  Behalf  Of  Valy  Sivec
>  Sent:  Friday,  April  14,  2006  10:48 
 AM
>  To:  flexcoders@yahoogroups.com
>  Subject:  RE:  [flexcoders]  FDS  & 
 Hibernate
>  
>  
>  
>  After  reading  the  Flex  Developer 
 guide  I  realized  that  might  be 
 too
early  to
>  integrate  DS&Hibernate  in  my 
 application.  DS  idea  is  great  but 
 not
having
>  the  Hibernate  adaptor  open  source 
 I  think  is  very  difficult  to  adopt 
 it.
>  
>  In  addition  to  that,  it  looks 
 that  there  is  no  support  for 
 annotation  at
>  this  moment  .  
>  
>  Do  you  guy  have  any  plans  in 
 going  away  from  the  XML  configuration
of  each
>  destination?.
>  
>  Thanks,
>  Valy
>  
>  Matt  Chotin  wrote:
>  
>  We���re  updating  the  hibernate 
 implementation  significantl

Re: [flexcoders] Re: FDS & Hibernate

2006-04-17 Thread Carlos Rovira



I never use Hibernate before, but suppose that it works mainly as entitys in EJB 2.x and is a great way to improve the way you talk with your database. The problem with EJB2.x is that we finish having a lot of files (ejb-jar.xml
, descriptors, interfaces, and so on...), so for an entity you could have seven files easily. Finaly, you should use XDoclet to maintain only one file and generate all others. Is a little annoying but better than write Java DAOs.
Now many vendors are creating the next generation of EJBs: EJB3 is build with EoD (Ease of development) in mind and I suppose that Adobe will support that in the future, but is normal that nowadays Flex 2 ship with a technology like Hibernate that is tested and works fine today. Many EJB3 solutions are in heavy development this days.
If you want to test a good one (but in preview)  I suggest you to see EasyBeans from ObjectWeb at :http://easybeans.objectweb.org/EasyBeans should work for JOnAS open source application server and other servlet containers like Tomcat and should ship in a few months. Nowadays you can download and test a preview from the site.
Best,C.On 4/17/06, box110a <[EMAIL PROTECTED]> wrote:



I the FDS Hibernate Adaptor will be a hard sell to the Java community.
Aspect Oriented Programming (AOP) is the latest programming buzzword,
but it has come about because coders want to write plain old java
objects (POJOs), and have a framework interject them where they are
needed. This has proven very flexible...I am able to use the same
POJOS within the Spring Framework, Hibernate, my JSPs or a swing app.  

We're using Java 5. This means we can use Hibernate Annotations to
define our ORM layer. After working with EJBs without EJBGen and then
working with it, Annotations save so much time and headache, I won't
use XML descriptor files.  The problem with FDS hibernate adaptor is
that if I want to use Annotations, I have to wait for Adobe to release
a version that supports it. Another problem is that I am tying my
persistance layer so closely to FDS, I can only use FDS to access it.
What happens if there is some critical bug in Hibernate that needs to
be fixed. I have to wait for Adobe to release it even though the
Hibernate team has fixed it.

If you've gotten this far, thanks for reading.
-JB




--- In flexcoders@yahoogroups.com, Valy Sivec <[EMAIL PROTECTED]> wrote:
>
> My understanding is that with FDS at this moment you shouldn't write
any DAO code and just the mapping files should suffice. On the other
hand, are Hibernate features that I don't see how to implement them
with the current Hibernate adapter; might be just me...
>   Anyway, I have chosen to use Java-JDO with Hibernate & Spring and
feel more comfortable about fixing the bugs in the code I can open
than having the bug in the Hibernate adapter. In addition to that
historicaly speaking, I haven't seen any BUG fixes or patches to the
Flex 1.5 and having the bugs fixed only via Flex Support seems to me a
little bit odd. That makes me even more reluctant to adopt Hibernate
Adapter. I hope that in the future Adobe will release the bug fixes in
patches available for everybody.
>    
>   Thanks,
>   Valy
>    
>    
>   
> [EMAIL PROTECTED] wrote:
>   Yep, just curious what functionality Hibernate adapter provides, 
> using of java-dao adapter should work fine with Hibernate-based
applications
> tho ;) 
> 
> Regards,
> Alex 
> 
> -Original Message-
> From: flexcoders@yahoogroups.com [mailto:
flexcoders@yahoogroups.com] On
> Behalf Of Matt Chotin
> Sent: Monday, April 17, 2006 2:35 AM
> To: flexcoders@yahoogroups.com
> Subject: RE: [flexcoders] FDS & Hibernate
> 
> I don't know that I agree with your premise that open source is the
only way
> to understand a technology to adopt it, but agree that the
documentation is
> behind the implementations. Hopefully when B3 comes out more
documentation
> will be available, and the changes that we made to the
implementation should
> allow you to use Hibernate with much less FDS configuration.
> 
> 
> 
> Matt
> 
> 
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:
flexcoders@yahoogroups.com] On
> Behalf Of Valy Sivec
> Sent: Friday, April 14, 2006 10:48 AM
> To: flexcoders@yahoogroups.com
> Subject: RE: [flexcoders] FDS & Hibernate
> 
> 
> 
> After reading the Flex Developer guide I realized that might be too
early to
> integrate DS&Hibernate in my application. DS idea is great but not
having
> the Hibernate adaptor open source I think is very difficult to adopt it.
> 
> In addition to that, it looks that there is no support for annotation at
> this moment . 
> 
> Do you guy have any plans in going away from the XML configuration
of each
> destination?.
> 
> Thanks,
> Valy
> 
> Matt Chotin wrote:
> 
> We’re updating the hibernate implementation significantly so I’d
expect
> some changes that should make integration easier. We’re also exposing
> more options on the DS to optimize for the case you describ

[flexcoders] Re: FDS & Hibernate

2006-04-17 Thread box110a
I the FDS Hibernate Adaptor will be a hard sell to the Java community.
Aspect Oriented Programming (AOP) is the latest programming buzzword,
but it has come about because coders want to write plain old java
objects (POJOs), and have a framework interject them where they are
needed. This has proven very flexible...I am able to use the same
POJOS within the Spring Framework, Hibernate, my JSPs or a swing app.  

We're using Java 5. This means we can use Hibernate Annotations to
define our ORM layer. After working with EJBs without EJBGen and then
working with it, Annotations save so much time and headache, I won't
use XML descriptor files.  The problem with FDS hibernate adaptor is
that if I want to use Annotations, I have to wait for Adobe to release
a version that supports it. Another problem is that I am tying my
persistance layer so closely to FDS, I can only use FDS to access it.
What happens if there is some critical bug in Hibernate that needs to
be fixed. I have to wait for Adobe to release it even though the
Hibernate team has fixed it.

If you've gotten this far, thanks for reading.
-JB




--- In flexcoders@yahoogroups.com, Valy Sivec <[EMAIL PROTECTED]> wrote:
>
> My understanding is that with FDS at this moment you shouldn't write
any DAO code and just the mapping files should suffice. On the other
hand, are Hibernate features that I don't see how to implement them
with the current Hibernate adapter; might be just me...
>   Anyway, I have chosen to use Java-JDO with Hibernate & Spring and
feel more comfortable about fixing the bugs in the code I can open
than having the bug in the Hibernate adapter. In addition to that
historicaly speaking, I haven't seen any BUG fixes or patches to the
Flex 1.5 and having the bugs fixed only via Flex Support seems to me a
little bit odd. That makes me even more reluctant to adopt Hibernate
Adapter. I hope that in the future Adobe will release the bug fixes in
patches available for everybody.
>
>   Thanks,
>   Valy
>
>
>   
> [EMAIL PROTECTED] wrote:
>   Yep, just curious what functionality Hibernate adapter provides, 
> using of java-dao adapter should work fine with Hibernate-based
applications
> tho ;) 
> 
> Regards,
> Alex 
> 
> -Original Message-
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Matt Chotin
> Sent: Monday, April 17, 2006 2:35 AM
> To: flexcoders@yahoogroups.com
> Subject: RE: [flexcoders] FDS & Hibernate
> 
> I don't know that I agree with your premise that open source is the
only way
> to understand a technology to adopt it, but agree that the
documentation is
> behind the implementations. Hopefully when B3 comes out more
documentation
> will be available, and the changes that we made to the
implementation should
> allow you to use Hibernate with much less FDS configuration.
> 
> 
> 
> Matt
> 
> 
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Valy Sivec
> Sent: Friday, April 14, 2006 10:48 AM
> To: flexcoders@yahoogroups.com
> Subject: RE: [flexcoders] FDS & Hibernate
> 
> 
> 
> After reading the Flex Developer guide I realized that might be too
early to
> integrate DS&Hibernate in my application. DS idea is great but not
having
> the Hibernate adaptor open source I think is very difficult to adopt it.
> 
> In addition to that, it looks that there is no support for annotation at
> this moment . 
> 
> Do you guy have any plans in going away from the XML configuration
of each
> destination?.
> 
> Thanks,
> Valy
> 
> Matt Chotin wrote:
> 
> We’re updating the hibernate implementation significantly so I’d
expect
> some changes that should make integration easier. We’re also exposing
> more options on the DS to optimize for the case you describe of
non-editable
> data where it doesn’t need to be kept in sync. So you absolutely
can use
> remote object instead but DS might also do the trick just fine.
> 
> 
> 
> Matt
> 
> 
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Valy Sivec
> Sent: Thursday, April 13, 2006 2:23 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] FDS & Hibernate
> 
> 
> 
> I start looking into the Data Services topics a little bit and I see
that
> for each destination there is a identity property that needs to be
defined.
> I have the data persistence layer implemented with Hibernate and I was
> wondering how Flex DES will handle objects with the identity
propetry NULL,
> knowing that Hibernate is smart enough to do an insert/update based
on the
> entity key's value. 
> 
> Have you guys integrated Flex DES with Hibernate data model in the
backend.?
> 
> 
> Also, in cases when I need to populate non-editable data, that
doesn't need
> to be kept in sync with the backed should I use remote objects
versus data
> services?. Any thoughts?.
> 
> Thanks,
> Valy
> 
> 
> 
> How low will we go? Check out Y