Hibernate3 Converter Objectarray as callback data

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Hibernate3 Converter Objectarray as callback data

p0wder
Hi all,

We use the hibernate3 converter and we call a function (on browser refresh), wich returns a multidimensional array that contains JAVA objects.

But the callback data seems to be random. Sometimes we get the whole array, sometimes one entry is missing. It also happens, that an object of the second dimension is completly missing (null).

greetings
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

david@butterdev.com
We can't help you when you provide no details (not even a DWR version).  
You need to try to debug this.  Have you verified that your Java method
returns the data you expect?  Have you debugged your JavaScript?  If you
have done all of that and you still have problems you need to send us
the relevant code.

On 12/09/2011 03:13 AM, p0wder wrote:

> Hi all,
>
> We use the hibernate3 converter and we call a function (on browser refresh),
> wich returns a multidimensional array that contains JAVA objects.
>
> But the callback data seems to be random. Sometimes we get the whole array,
> sometimes one entry is missing. It also happens, that an object of the
> second dimension is completly missing (null).
>
> greetings
>
> --
> View this message in context: http://dwr.2114559.n2.nabble.com/Hibernate3-Converter-Objectarray-as-callback-data-tp7077663p7077663.html
> Sent from the DWR - Users mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

p0wder
Okey thanks for your reply. We use Version 2.0.7.

We debuged the JAVA method. It returns the right data. But if we test the method with the dwr testpage it we get the same data as we get in our JavaScript funcktion.

If we use the normal bean-converter it works fine but the application gets awfully slow because DWR serializes the whole database.

The array contains javaobjects of the type "idea". idea contains a few attributes such as a timestamp, content and so on. But it contains also an object of the type "user" wich represents the user who has written the idea. DWR returns sometimes an uncomplete array where several ideas are missing. And even if all ideas are returned in some ideas the user-object is missing (null).
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

david@butterdev.com
I am sorry but I can't help with the details your are providing.  It is not clear what the problem is.  Not only do we have tests for the converters but they are being used successfully by many users.  This leads me to believe there is something wrong with your application.  Have you checked the server logs?  Do you have a converter specified for all of the custom types in the array (User, etc.)?  If you want us to look at this you need to send us a minimized war (only reproduces the problem) and source code that demonstrates the problem.

On Mon, Dec 12, 2011 at 5:55 AM, p0wder <[hidden email]> wrote:
Okey thanks for your reply. We use Version 2.0.7.

We debuged the JAVA method. It returns the right data. But if we test the
method with the dwr testpage it we get the same data as we get in our
JavaScript funcktion.

If we use the normal bean-converter it works fine but the application gets
awfully slow because DWR serializes the whole database.

The array contains javaobjects of the type "idea". idea contains a few
attributes such as a timestamp, content and so on. But it contains also an
object of the type "user" wich represents the user who has written the idea.
DWR returns sometimes an uncomplete array where several ideas are missing.
And even if all ideas are returned in some ideas the user-object is missing
(null).

--
View this message in context: http://dwr.2114559.n2.nabble.com/Hibernate3-Converter-Objectarray-as-callback-data-tp7077663p7085988.html
Sent from the DWR - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

david@butterdev.com
Also, I am assuming you read our docs on Hibernate:
http://directwebremoting.org/dwr/documentation/server/integration/hibernate.html

The whole point of the Hibernate converter is that it doesn't read/serialize lazy loaded properties.  My guess is the properties missing from serialization are lazy loaded which is why they are missing. 

On Mon, Dec 12, 2011 at 1:34 PM, David Marginian <[hidden email]> wrote:
I am sorry but I can't help with the details your are providing.  It is not clear what the problem is.  Not only do we have tests for the converters but they are being used successfully by many users.  This leads me to believe there is something wrong with your application.  Have you checked the server logs?  Do you have a converter specified for all of the custom types in the array (User, etc.)?  If you want us to look at this you need to send us a minimized war (only reproduces the problem) and source code that demonstrates the problem.

On Mon, Dec 12, 2011 at 5:55 AM, p0wder <[hidden email]> wrote:
Okey thanks for your reply. We use Version 2.0.7.

We debuged the JAVA method. It returns the right data. But if we test the
method with the dwr testpage it we get the same data as we get in our
JavaScript funcktion.

If we use the normal bean-converter it works fine but the application gets
awfully slow because DWR serializes the whole database.

The array contains javaobjects of the type "idea". idea contains a few
attributes such as a timestamp, content and so on. But it contains also an
object of the type "user" wich represents the user who has written the idea.
DWR returns sometimes an uncomplete array where several ideas are missing.
And even if all ideas are returned in some ideas the user-object is missing
(null).

--
View this message in context: http://dwr.2114559.n2.nabble.com/Hibernate3-Converter-Objectarray-as-callback-data-tp7077663p7085988.html
Sent from the DWR - Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

Mike Wilson
Administrator
Exactly. When using the hibernate integration your Java code has to ensure that the desired objects are fully loaded in the result set before returning through DWR.
 
Best regards
Mike Wilson
 
David Marginian wrote:
Also, I am assuming you read our docs on Hibernate:
http://directwebremoting.org/dwr/documentation/server/integration/hibernate.html

The whole point of the Hibernate converter is that it doesn't read/serialize lazy loaded properties.  My guess is the properties missing from serialization are lazy loaded which is why they are missing. 

On Mon, Dec 12, 2011 at 1:34 PM, David Marginian <[hidden email]> wrote:
I am sorry but I can't help with the details your are providing.  It is not clear what the problem is.  Not only do we have tests for the converters but they are being used successfully by many users.  This leads me to believe there is something wrong with your application.  Have you checked the server logs?  Do you have a converter specified for all of the custom types in the array (User, etc.)?  If you want us to look at this you need to send us a minimized war (only reproduces the problem) and source code that demonstrates the problem.

On Mon, Dec 12, 2011 at 5:55 AM, p0wder <[hidden email]> wrote:
Okey thanks for your reply. We use Version 2.0.7.

We debuged the JAVA method. It returns the right data. But if we test the
method with the dwr testpage it we get the same data as we get in our
JavaScript funcktion.

If we use the normal bean-converter it works fine but the application gets
awfully slow because DWR serializes the whole database.

The array contains javaobjects of the type "idea". idea contains a few
attributes such as a timestamp, content and so on. But it contains also an
object of the type "user" wich represents the user who has written the idea.
DWR returns sometimes an uncomplete array where several ideas are missing.
And even if all ideas are returned in some ideas the user-object is missing
(null).

--
View this message in context: http://dwr.2114559.n2.nabble.com/Hibernate3-Converter-Objectarray-as-callback-data-tp7077663p7085988.html
Sent from the DWR - Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

p0wder
We disabled lazy loading in the hibernate mapping files.
But we still revieve sometimes incomplete data.

Here e few code snippets.. Hope this helps:

JAVA Function
//class Project
public static Idea[] getIdeaArray(int projectId) {
        Project project = Project.findprojectById(projectId);
        if (project == null) {
            return null;
        }
        Set<Idea> ideaSet = project.getIdeas();
        //Converts java.util.Set to java.util.List for sorting
        List<Idea> ideaList = new ArrayList<Idea>(ideaSet);
        Comparator<Idea> comp = new IdeaComparator();
        Collections.sort(ideaList, comp);
        //Converts java.util.List to Array for return
        Idea[] arrIdeas = new Idea[ideaList.size()];
        arrIdeas = ideaList.toArray(arrIdeas);
        return arrIdeas;
    }
JavaScript
<quote>
project.getIdeaArray(projectId, function(data){
        for (var i=0; i<data.length; i++) {
            if (data[i]['parentIdeaId'] == 0){
                writeIdea(data[i], "rnd_idea_0");
                checkComments(data, data[i]['idIdea'])
            }
        }
    });
</quote>

dwr.xml
     <convert match="java.lang.Exception" converter="exception">
       
    </convert>
   
    <convert converter="hibernate3" match="engine.*">
    </convert>

    <create creator="new" javascript="project">
     
    </create>
   
    <create creator="new" javascript="idea">
     
    </create>
Greetings
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

david@butterdev.com
No it does not help.  What data is missing?  What do you mean by
"sometimes"?

On 02/29/2012 07:54 AM, p0wder wrote:

> We disabled lazy loading in the hibernate mapping files.
> But we still revieve sometimes incomplete data.
>
> Here e few code snippets.. Hope this helps:
>
> JAVA Function
>
>
>> //class Project
>> public static Idea[] getIdeaArray(int projectId) {
>>          Project project = Project.findprojectById(projectId);
>>          if (project == null) {
>>              return null;
>>          }
>>          Set<Idea>  ideaSet = project.getIdeas();
>>          //Converts java.util.Set to java.util.List for sorting
>>          List<Idea>  ideaList = new ArrayList<Idea>(ideaSet);
>>          Comparator<Idea>  comp = new IdeaComparator();
>>          Collections.sort(ideaList, comp);
>>          //Converts java.util.List to Array for return
>>          Idea[] arrIdeas = new Idea[ideaList.size()];
>>          arrIdeas = ideaList.toArray(arrIdeas);
>>          return arrIdeas;
>>      }
>>
> JavaScript
>
> project.getIdeaArray(projectId, function(data){
>          for (var i=0; i<data.length; i++) {
>              if (data[i]['parentIdeaId'] == 0){
>                  writeIdea(data[i],&quot;rnd_idea_0&quot;);
>                  checkComments(data, data[i]['idIdea'])
>              }
>          }
>      });
> &lt;/quote>
>
> dwr.xml
>
>
>>       <convert match="java.lang.Exception" converter="exception">
>>
>>      </convert>
>>
>>      <convert converter="hibernate3" match="engine.*">
>>      </convert>
>>
>>      <create creator="new" javascript="project">
>>
>>      </create>
>>
>>      <create creator="new" javascript="idea">
>>
>>      </create>
>>
> Greetings
>
> --
> View this message in context: http://dwr.2114559.n2.nabble.com/Hibernate3-Converter-Objectarray-as-callback-data-tp7077663p7329448.html
> Sent from the DWR - Users mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

p0wder
The JavaScript is part of the onload-function of a html page. The array we return in the Java function has allways the same size. But the data we recieve in the callback function is not allways the same size. So if we return an array with the size 15 from the Java funciton getIdeaArray we recieve an array with the size 14 in the JavaScript callback function. After a browserrefresh we recieve 13. After another refresh maybe 15. So there is a single or multiple elements missing in the callback data and there is no fix order after how many refreshs data is missing.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

david@butterdev.com
Have you retried making your call on the DWR test page since you
disabled lazy loading?  Are you certain you are verifying the items on
the server side with every call (how are you doing this, logging?
breakpoint and inspection?).

On 03/01/2012 01:23 AM, p0wder wrote:

> The JavaScript is part of the onload-function of a html page. The array we
> return in the Java function has allways the same size. But the data we
> recieve in the callback function is not allways the same size. So if we
> return an array with the size 15 from the Java funciton getIdeaArray we
> recieve an array with the size 14 in the JavaScript callback function. After
> a browserrefresh we recieve 13. After another refresh maybe 15. So there is
> a single or multiple elements missing in the callback data and there is no
> fix order after how many refreshs data is missing.
>
>
> --
> View this message in context: http://dwr.2114559.n2.nabble.com/Hibernate3-Converter-Objectarray-as-callback-data-tp7077663p7331921.html
> Sent from the DWR - Users mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

p0wder
Yes, we got the same problem on the test page.
First of all we tested the function with JUnit.
We also debuged the function. The server side array is complete at the return, but the callback data is still randomly incomplete.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

david@butterdev.com
It is very difficult to help since I cannot reproduce the issue.  If you can create the simplest example possible where you can reproduce the issue and send it to us (war with source) we can take a look.

On Thu, Mar 1, 2012 at 6:23 AM, p0wder <[hidden email]> wrote:
Yes, we got the same problem on the test page.
First of all we tested the function with JUnit.
We also debuged the function. The server side array is complete at the
return, but the callback data is still randomly incomplete.

--
View this message in context: http://dwr.2114559.n2.nabble.com/Hibernate3-Converter-Objectarray-as-callback-data-tp7077663p7332521.html
Sent from the DWR - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

david@butterdev.com
Or download the DWR source and put a breakpoint in the Hibernate converter and see what is going on.

On Thu, Mar 1, 2012 at 8:14 AM, David Marginian <[hidden email]> wrote:
It is very difficult to help since I cannot reproduce the issue.  If you can create the simplest example possible where you can reproduce the issue and send it to us (war with source) we can take a look.


On Thu, Mar 1, 2012 at 6:23 AM, p0wder <[hidden email]> wrote:
Yes, we got the same problem on the test page.
First of all we tested the function with JUnit.
We also debuged the function. The server side array is complete at the
return, but the callback data is still randomly incomplete.

--
View this message in context: http://dwr.2114559.n2.nabble.com/Hibernate3-Converter-Objectarray-as-callback-data-tp7077663p7332521.html
Sent from the DWR - Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

p0wder
Is it may be possible, that we got a problem with the browser cache? Since we recieve the whole array on the very first start after the build. But if we add or remove something we got the problem we mentioned above.

We try to reproduce the problem with an arraylist. We'll post it as soon as we did it.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

david@butterdev.com
If it were a caching issue I would expect to see the same data, not different data.

On Wed, Mar 7, 2012 at 8:50 AM, p0wder <[hidden email]> wrote:
Is it may be possible, that we got a problem with the browser cache? Since we
recieve the whole array on the very first start after the build. But if we
add or remove something we got the problem we mentioned above.

We try to reproduce the problem with an arraylist. We'll post it as soon as
we did it.

--
View this message in context: http://dwr.2114559.n2.nabble.com/Hibernate3-Converter-Objectarray-as-callback-data-tp7077663p7352176.html
Sent from the DWR - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

panditps
Hi All,

I am new to dwr and hibernate.
I m getting below exception.
couldent fine why and where it is generating this error.
Please Help me.

Exception is:

ALERT: ERROR o.d.d.DefaultConverterManager - No converter found for 'oracle.sql.INTERVALDS'
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

david@butterdev.com
The error is pretty clear, you are trying to return a oracle.sql.INERVALDS and you have not specified a converter for that type.  Please spend some time reading the DWR documentation for converters - http://directwebremoting.org/dwr/documentation/server/configuration/dwrxml/converters/index.html

On Mon, Mar 26, 2012 at 7:10 AM, panditps <[hidden email]> wrote:
Hi All,

I am new to dwr and hibernate.
I m getting below exception.
couldent fine why and where it is generating this error.
Please Help me.

Exception is:

ALERT: ERROR o.d.d.DefaultConverterManager - No converter found for
'oracle.sql.INTERVALDS'

--
View this message in context: http://dwr.2114559.n2.nabble.com/Hibernate3-Converter-Objectarray-as-callback-data-tp7077663p7405820.html
Sent from the DWR - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

panditps
Thanks for your reply David.
Do i need to put conveter for INTERVALDS in dwr.xml?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hibernate3 Converter Objectarray as callback data

david@butterdev.com
Yes, or not return that type.  Why don't you read the docs?  Basic questions like these show you have not spent anytime trying to help yourself which makes other less likely to help you.

On Mon, Mar 26, 2012 at 8:32 AM, panditps <[hidden email]> wrote:
Thanks for your reply David.
Do i need to put conveter for INTERVALDS in dwr.xml?

--
View this message in context: http://dwr.2114559.n2.nabble.com/Hibernate3-Converter-Objectarray-as-callback-data-tp7077663p7406087.html
Sent from the DWR - Users mailing list archive at Nabble.com.

Loading...