Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Thu Jan 12, 2006 6:16 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
I think it is better to throw "IllegalStateException" if collection is in illegal state than to return wrong result.


Top
 Profile  
 
 Post subject: throwing error halts process
PostPosted: Thu Jan 12, 2006 6:27 pm 
Beginner
Beginner

Joined: Wed Jun 15, 2005 1:28 pm
Posts: 34
Location: United States
We're trying to stop exceptions from being thrown. They stop the de/serialization process of our object responses in our second tier dead in it's tracks, and communication stops.

I'm trying to establish UNinitialized as a legal state for a collection, such that it can pass safely in/out of other third party software tiers.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 1:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This thread is unbelievable.

This is *clearly* a problem of the XML serialization framework not having sufficient extension points.

It is absolutely not our fault.


Please people - get off the crackpipe!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 1:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
" I can see it as very interesting to have an object property even visible on the client that the Set is in this state."

Hibernate.isInitialized(object or set);

There is your property!

Changing the public api of java collection to mean something else is *wrong*, e.g. unitializedSet.hasNext() should not return false because that is *inconsistent* since you then cannot distinguish between "empty set" and "not fetched yet".

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 2:00 am 
Beginner
Beginner

Joined: Wed Jun 15, 2005 1:28 pm
Posts: 34
Location: United States
Gavin,

There is no need for the crackpipe comments. Please allow this to proceed as a professional discussion about technical issues being faced in the field using Hibernate technology.

You're correct on both counts. It's not being correct that matters here - but that the job gets done. At the end of a day, if the customer does not have a solution, nothing else matters.

1. If there were an extension point in the Adobe (Macromedia) Flash Remoting gateway server we would be all over it. There aren't at the moment. The product is not open source. It's a huge company to try and lobby for enhancements. We're still waiting for reported bugs to be fixed, let alone enhancements. Isnt' open source designed to change this?

2. It's not a hibernate "fault". It's an absence of developer control over a feature which is causing a perfectly good method in a third party framework to crash. This feature, 99% of the time, is helpful and necessary. However, what we've run into is something the current design has not allowed for - introspection of an object outside the session through reflection causing lazy initialization (exception).

We saw a solution to this easily within our reach with this project. We pursued it, and were mistaken.

I will conclude by being respectful, saying thank you for what your product does, it is a nice piece of software. It has missing features, as all software does, and we may add them. It would be more work for us to maintain our features through the releases, but we will manage, or find another solution, or maybe eventually Adobe will enhance Flash Remoting so it plays better with ORM frameworks. Maybe they will read this thread?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 2:07 am 
Beginner
Beginner

Joined: Wed Jun 15, 2005 1:28 pm
Posts: 34
Location: United States
Max, the reply never reaches my client because Hiberante has already crashed the response in my serialization tier during introspection. Unless I can fix this nothing will ever reach the client.

If the uninitialized collection appeared null we would not have a problem, but Java does not contain the ability to override operators. The proxy object exists in the property, and can not intercept Java code testing the existance of data in the collection (to make appear it null).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 2:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
(1) I had assumed that the word "crackpipe" would be taken in the humorous vein it was intended.

(2) You need to realize that if we put dangerous and/or half-thought features into our product then we will regret it 1000 times over. Getting something like Hibernate right is certainly as much about what you leave out.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 2:26 am 
Beginner
Beginner

Joined: Wed Jun 15, 2005 1:28 pm
Posts: 34
Location: United States
I fully appreciate the thought that goes into desgin.

But if I can't even send a few objects back to my client, how's that for design? In this case the LazyInitializationException is over-designed protection from my own code. Not in all cases, please, but in this case.

Here's an article on the O'Reilly network which discusses the "pitfalls" as they call it in using Hibernate with Flash Remoting.

See the headline Integrating Flex with the Persistence Layer

http://www.onjava.com/pub/a/onjava/2004/12/01/flexjava.html?page=2

They suggest using AOP to intercept and set your proxies to null... Do you agree?[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 2:38 am 
Beginner
Beginner

Joined: Wed Jun 15, 2005 1:28 pm
Posts: 34
Location: United States
Also see the JBOSS website for a PDF slideshow which describes integrating Flex with Hibernate. Slide #27 shows the same strategy as recommended by the O'Reilly article - an AOP Interceptor to remove the dynamic proxies.

[link]http://www.jboss.com/pdf/jbworld/ria_matrix_resources.pdf[/link]

I believe I will investigate this option, unless you have further suggestions.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 4:12 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Hibernate lazy loading is customizeable and you can hack it to implement this workaround, see "Custom Persister".


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 4:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
As said a couple of times now :)

It will not get into the core for good reasons

You have all the hooks you want in Hibernate to change this behavior
(interceptor, custom entity and collection persister, proxy class, event system) and it is opensource meaning you can patch it to be as inconsistent as you want ;)

The AOP trick sounds like and ok workaround the fact that the *serialization* framework you use does not have methods for customization of detecting the non-fetched boundaries of your
object graph.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Done
PostPosted: Fri Jan 13, 2006 3:36 pm 
Regular
Regular

Joined: Sat Jan 22, 2005 6:57 pm
Posts: 50
Location: Chicago
We opted to go with our own hook to workaround this issue. Overtime, the Hibernate team may eventually realize that many people are writing their own hooks that do essentially the same thing. They will find commonality and create something we need then.

Today, they do not see a need. I would encourage anyone who reads this and is looking for a similar solution to just post at the end of this thread. If there are only a few posts, I'm fine with that.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 3:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
why is it that you don't contribute the workaround/feature you have created to the hibernate wiki so everyone can see an example of how to make it work in your Flex scenario ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.