Re: GWT with Hibernate and Oracle

2011-02-08 Thread Néstor Boscán
Oh Sorry Debashish

I see that you're working with Google App Engine. I've worked with Google
Web Toolkit and Hibernate for standalone applications, not applications that
are deployed on Google App Engine. The link that you sent me is for Google
Web Toolkit + Hibernate. I imagine that Google App Engine has restrictions
on the classes that you can use, in this case java.net.Socket. I think, and
again I'm no expert on GAE, that you can't use any database you want, you
have to use the database that the GAE documentation describes. If it's
something like BigTable, I don't know if you can use Hibernate on top of
that. I think that I read an article on using Java Persistant Architecture,
which is an abstraction of what Hibernate does, with GAE.

Regards,

Néstor Boscán

On Tue, Feb 8, 2011 at 9:31 AM, Debashish  wrote:

> Hi Néstor,
>
> I have followed all the steps which required a Hibernate application
> to work.
> And this sample hibernate module is working fine without GWT as UI.
>
> However while connecting to any Database we need to put Driver class
> in the classpath and
> hibernate also requires the Classes12.jar or ojdbc14.jar at it's
> classpath.
> This is required so that it can understand the driver property placed
> in hibernate.cfg.xml file
>  name="connection.driver_class">oracle.jdbc.driver.OracleDriver property>
>
> And probaly this class is not allowed in Google APP and I am getting
> an error as
> ---
> Caused by: java.lang.NoClassDefFoundError: java.net.Socket is a
> restricted class. Please see the Google  App Engine
> developer's guide for more details.
> ---
>
> *** This is the local database in my case and I am absolutely getting
> no way to resolve it.
>
> Please sugggest me if any other approach / websites to follow for
> this.
>
> Thanks
> Debashish
>
> On Feb 6, 1:55 am, Néstor Boscán  wrote:
> > Hi
> >
> > I checked the link that you sent and this is will work of course but you
> > will have to create a lot of DTO objects for your application and map the
> > POJO objects from Hibernate to the DTO which will require a lot of
> coding.
> > The example should work, your DTOs should be serialized, Now what I don't
> > understand is that if you're using Hibernate why use JDBC directly?. You
> can
> > get a Connection to your database from the Session object or create an a
> > SQLQuery. From what I'm reading it looks like you're using
> java.net.Socket
> > on the GWT Client side and this is not a valid class.
> >
> > Regards,
> >
> > Néstor Boscán
> >
> >
> >
> > On Sat, Feb 5, 2011 at 2:52 PM, Debashish 
> wrote:
> > > Hi Néstor,
> >
> > > Thank you for the response regarding the Hibernate with GWT.
> >
> > > However I have followed the similar approach given in the below link
> >
> > >
> http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
> > > which suggets to use DTO approach to map the hibernate domain object
> > > to DTO
> > > and passed to the data to GWT layer.
> >
> > > I have a query on the Local Database connectivity from GWT. Is it
> > > possible to make a
> > > JDBC call(using Oracle Thin Driver). I have tried a normal jdbc
> > > connection from GWT
> > > using classes12.jar file in classpath and using
> > > Class.forName("Oracle.jdbc.driver.OracleDriver").
> > > I have deployed on Google Apps server.
> >
> > > I am getting the below error message while while running the
> > > application.
> >
> > >
> ---­---
> > > java.net.Socket is a restricted class. Please see the Google  App
> > > Engine developer's guide for more details.
> > > [ERROR] javax.servlet.ServletContext log: Exception while dispatching
> > > incoming RPC call
> > > com.google.gwt.user.server.rpc.UnexpectedException: Service method
> > > 'public abstract java.lang.Long
> >
> > >
> com.google.musicstore.client.MusicStoreService.saveAccount(com.google.music­­
> > > store.client.dto.AccountDTO)'
> > > threw an unexpected exception: java.lang.ExceptionInInitializerError
> > >at
> > > com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
> > > 378)
> >
> > >
> ---­--
> >
> > > Could you please suggest me of any good links or site which provides
> > > an approach to develope GWT aplications
> > > using local database.
> >
> > > Thanks
> > > Dev
> >
> > > On Jan 26, 5:20 pm, Néstor Boscán  wrote:
> > > > This is very tipical in Hibernate applications that have to serialize
> > > > objects through the network be it GWT, Web Services, JSON, etc.
> Hibernate
> > > > will leave his own POJO in your objects for lazy initialization
> purposes.
> > > > When GWT or a Web Service tries to serialize the objects and opens
> the
> > > > hibernate POJO it will throw LazyInitializationException because the
> > > > connection is already closed. 

Re: GWT with Hibernate and Oracle

2011-02-08 Thread Debashish
Hi Néstor,

I have followed all the steps which required a Hibernate application
to work.
And this sample hibernate module is working fine without GWT as UI.

However while connecting to any Database we need to put Driver class
in the classpath and
hibernate also requires the Classes12.jar or ojdbc14.jar at it's
classpath.
This is required so that it can understand the driver property placed
in hibernate.cfg.xml file
oracle.jdbc.driver.OracleDriver

And probaly this class is not allowed in Google APP and I am getting
an error as
---
Caused by: java.lang.NoClassDefFoundError: java.net.Socket is a
restricted class. Please see the Google  App Engine
developer's guide for more details.
---

*** This is the local database in my case and I am absolutely getting
no way to resolve it.

Please sugggest me if any other approach / websites to follow for
this.

Thanks
Debashish

On Feb 6, 1:55 am, Néstor Boscán  wrote:
> Hi
>
> I checked the link that you sent and this is will work of course but you
> will have to create a lot of DTO objects for your application and map the
> POJO objects from Hibernate to the DTO which will require a lot of coding.
> The example should work, your DTOs should be serialized, Now what I don't
> understand is that if you're using Hibernate why use JDBC directly?. You can
> get a Connection to your database from the Session object or create an a
> SQLQuery. From what I'm reading it looks like you're using java.net.Socket
> on the GWT Client side and this is not a valid class.
>
> Regards,
>
> Néstor Boscán
>
>
>
> On Sat, Feb 5, 2011 at 2:52 PM, Debashish  wrote:
> > Hi Néstor,
>
> > Thank you for the response regarding the Hibernate with GWT.
>
> > However I have followed the similar approach given in the below link
>
> >http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
> > which suggets to use DTO approach to map the hibernate domain object
> > to DTO
> > and passed to the data to GWT layer.
>
> > I have a query on the Local Database connectivity from GWT. Is it
> > possible to make a
> > JDBC call(using Oracle Thin Driver). I have tried a normal jdbc
> > connection from GWT
> > using classes12.jar file in classpath and using
> > Class.forName("Oracle.jdbc.driver.OracleDriver").
> > I have deployed on Google Apps server.
>
> > I am getting the below error message while while running the
> > application.
>
> > ---­---
> > java.net.Socket is a restricted class. Please see the Google  App
> > Engine developer's guide for more details.
> > [ERROR] javax.servlet.ServletContext log: Exception while dispatching
> > incoming RPC call
> > com.google.gwt.user.server.rpc.UnexpectedException: Service method
> > 'public abstract java.lang.Long
>
> > com.google.musicstore.client.MusicStoreService.saveAccount(com.google.music­­
> > store.client.dto.AccountDTO)'
> > threw an unexpected exception: java.lang.ExceptionInInitializerError
> >        at
> > com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
> > 378)
>
> > ---­--
>
> > Could you please suggest me of any good links or site which provides
> > an approach to develope GWT aplications
> > using local database.
>
> > Thanks
> > Dev
>
> > On Jan 26, 5:20 pm, Néstor Boscán  wrote:
> > > This is very tipical in Hibernate applications that have to serialize
> > > objects through the network be it GWT, Web Services, JSON, etc. Hibernate
> > > will leave his own POJO in your objects for lazy initialization purposes.
> > > When GWT or a Web Service tries to serialize the objects and opens the
> > > hibernate POJO it will throw LazyInitializationException because the
> > > connection is already closed. What I've done in my applications is to
> > clean
> > > the POJO of any Hibernate references. This is done with a Hibernate
> > Cleaner
> > > class. On the web there are a couple of examples of this.
>
> > > Regards,
>
> > > Néstor Boscán
>
> > > On Tue, Jan 25, 2011 at 2:33 PM, Debashish 
> > wrote:
> > > > Hi
>
> > > > I am trying for a sample using GWT and database layer as Hibernate
> > > > with Oracle on Google Aps server.
>
> > > > I have done a sample for Hibernate with JSP as presentation layer,
> > > > which is working fine.
> > > > But the same approach is not working with GWT.
>
> > > > Here is a verygood link on this topic
>
> >http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
> > > > and my approach is almost similar.
>
> > > > I have followed the below approach,
> > > > The RemoteServiceServlet makes a call to Hibernate layer and tries the
> > > > initializes the SessionFactory as below,
> > > >      sessionFactory = new
> > > > Configuration().configure().buildSessionFactory();
>
> > > > I have added the jars necessary for the Hibernate

Re: GWT with Hibernate and Oracle

2011-02-05 Thread Néstor Boscán
Hi

I checked the link that you sent and this is will work of course but you
will have to create a lot of DTO objects for your application and map the
POJO objects from Hibernate to the DTO which will require a lot of coding.
The example should work, your DTOs should be serialized, Now what I don't
understand is that if you're using Hibernate why use JDBC directly?. You can
get a Connection to your database from the Session object or create an a
SQLQuery. From what I'm reading it looks like you're using java.net.Socket
on the GWT Client side and this is not a valid class.

Regards,

Néstor Boscán

On Sat, Feb 5, 2011 at 2:52 PM, Debashish  wrote:

> Hi Néstor,
>
> Thank you for the response regarding the Hibernate with GWT.
>
> However I have followed the similar approach given in the below link
>
> http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
> which suggets to use DTO approach to map the hibernate domain object
> to DTO
> and passed to the data to GWT layer.
>
> I have a query on the Local Database connectivity from GWT. Is it
> possible to make a
> JDBC call(using Oracle Thin Driver). I have tried a normal jdbc
> connection from GWT
> using classes12.jar file in classpath and using
> Class.forName("Oracle.jdbc.driver.OracleDriver").
> I have deployed on Google Apps server.
>
> I am getting the below error message while while running the
> application.
>
> --
> java.net.Socket is a restricted class. Please see the Google  App
> Engine developer's guide for more details.
> [ERROR] javax.servlet.ServletContext log: Exception while dispatching
> incoming RPC call
> com.google.gwt.user.server.rpc.UnexpectedException: Service method
> 'public abstract java.lang.Long
>
> com.google.musicstore.client.MusicStoreService.saveAccount(com.google.music­
> store.client.dto.AccountDTO)'
> threw an unexpected exception: java.lang.ExceptionInInitializerError
>at
> com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
> 378)
>
> -
>
> Could you please suggest me of any good links or site which provides
> an approach to develope GWT aplications
> using local database.
>
> Thanks
> Dev
>
>
>
>
>
> On Jan 26, 5:20 pm, Néstor Boscán  wrote:
> > This is very tipical in Hibernate applications that have to serialize
> > objects through the network be it GWT, Web Services, JSON, etc. Hibernate
> > will leave his own POJO in your objects for lazy initialization purposes.
> > When GWT or a Web Service tries to serialize the objects and opens the
> > hibernate POJO it will throw LazyInitializationException because the
> > connection is already closed. What I've done in my applications is to
> clean
> > the POJO of any Hibernate references. This is done with a Hibernate
> Cleaner
> > class. On the web there are a couple of examples of this.
> >
> > Regards,
> >
> > Néstor Boscán
> >
> >
> >
> > On Tue, Jan 25, 2011 at 2:33 PM, Debashish 
> wrote:
> > > Hi
> >
> > > I am trying for a sample using GWT and database layer as Hibernate
> > > with Oracle on Google Aps server.
> >
> > > I have done a sample for Hibernate with JSP as presentation layer,
> > > which is working fine.
> > > But the same approach is not working with GWT.
> >
> > > Here is a verygood link on this topic
> >
> > >
> http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
> > > and my approach is almost similar.
> >
> > > I have followed the below approach,
> > > The RemoteServiceServlet makes a call to Hibernate layer and tries the
> > > initializes the SessionFactory as below,
> > >  sessionFactory = new
> > > Configuration().configure().buildSessionFactory();
> >
> > > I have added the jars necessary for the Hibernate layer (and
> > > classes12.jar for oracle driver).
> >
> > > However while running , it is giving me an error as below,
> >
> > >
> ---­-
> > > Initial SessionFactory creation failed.java.lang.NoClassDefFoundError:
> > > java.net.Socket is a restricted class. Please see the Google  App
> > > Engine developer's guide for more details.
> > > [ERROR] javax.servlet.ServletContext log: Exception while dispatching
> > > incoming RPC call
> > > com.google.gwt.user.server.rpc.UnexpectedException: Service method
> > > 'public abstract java.lang.Long
> >
> > >
> com.google.musicstore.client.MusicStoreService.saveAccount(com.google.music­store.client.dto.AccountDTO)'
> > > threw an unexpected exception: java.lang.ExceptionInInitializerError
> > >at
> > > com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
> > > 378)
> >
> > >
> ---­-
> > >

Re: GWT with Hibernate and Oracle

2011-02-05 Thread Debashish
Hi Néstor,

Thank you for the response regarding the Hibernate with GWT.

However I have followed the similar approach given in the below link
 
http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
which suggets to use DTO approach to map the hibernate domain object
to DTO
and passed to the data to GWT layer.

I have a query on the Local Database connectivity from GWT. Is it
possible to make a
JDBC call(using Oracle Thin Driver). I have tried a normal jdbc
connection from GWT
using classes12.jar file in classpath and using
Class.forName("Oracle.jdbc.driver.OracleDriver").
I have deployed on Google Apps server.

I am getting the below error message while while running the
application.
--
java.net.Socket is a restricted class. Please see the Google  App
Engine developer's guide for more details.
[ERROR] javax.servlet.ServletContext log: Exception while dispatching
incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract java.lang.Long
com.google.musicstore.client.MusicStoreService.saveAccount(com.google.music­
store.client.dto.AccountDTO)'
threw an unexpected exception: java.lang.ExceptionInInitializerError
at
com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
378)
-

Could you please suggest me of any good links or site which provides
an approach to develope GWT aplications
using local database.

Thanks
Dev





On Jan 26, 5:20 pm, Néstor Boscán  wrote:
> This is very tipical in Hibernate applications that have to serialize
> objects through the network be it GWT, Web Services, JSON, etc. Hibernate
> will leave his own POJO in your objects for lazy initialization purposes.
> When GWT or a Web Service tries to serialize the objects and opens the
> hibernate POJO it will throw LazyInitializationException because the
> connection is already closed. What I've done in my applications is to clean
> the POJO of any Hibernate references. This is done with a Hibernate Cleaner
> class. On the web there are a couple of examples of this.
>
> Regards,
>
> Néstor Boscán
>
>
>
> On Tue, Jan 25, 2011 at 2:33 PM, Debashish  wrote:
> > Hi
>
> > I am trying for a sample using GWT and database layer as Hibernate
> > with Oracle on Google Aps server.
>
> > I have done a sample for Hibernate with JSP as presentation layer,
> > which is working fine.
> > But the same approach is not working with GWT.
>
> > Here is a verygood link on this topic
>
> >http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
> > and my approach is almost similar.
>
> > I have followed the below approach,
> > The RemoteServiceServlet makes a call to Hibernate layer and tries the
> > initializes the SessionFactory as below,
> >      sessionFactory = new
> > Configuration().configure().buildSessionFactory();
>
> > I have added the jars necessary for the Hibernate layer (and
> > classes12.jar for oracle driver).
>
> > However while running , it is giving me an error as below,
>
> > ---­-
> > Initial SessionFactory creation failed.java.lang.NoClassDefFoundError:
> > java.net.Socket is a restricted class. Please see the Google  App
> > Engine developer's guide for more details.
> > [ERROR] javax.servlet.ServletContext log: Exception while dispatching
> > incoming RPC call
> > com.google.gwt.user.server.rpc.UnexpectedException: Service method
> > 'public abstract java.lang.Long
>
> > com.google.musicstore.client.MusicStoreService.saveAccount(com.google.music­store.client.dto.AccountDTO)'
> > threw an unexpected exception: java.lang.ExceptionInInitializerError
> >        at
> > com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
> > 378)
>
> > ---­-
> > I have one through some of the threads which suggested me to download
> > the google apps jar files and try it. I have downladed it. but there
> > is no proper direction on how to make use of which jar file.
>
> > Have anybody tried the same. Please let me know if anything I am doing
> > wrong.
> > *** Note that I am using Oracle 9.2 as local database.
>
> > Thanks
> > Dev
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to google-web-toolkit@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because

Re: GWT with Hibernate and Oracle

2011-01-27 Thread Nagin Kothari
Thanks a lot  Néstor


regards,

Nagin


2011/1/27 Néstor Boscán 

> I found this one on the web:
>
> http://maherkilani.blogspot.com/2008/12/hibernate-proxy-cleaner.html
>
> Regards,
>
> Néstor Boscán
>
>  On Thu, Jan 27, 2011 at 2:15 AM, Nagin Kothari wrote:
>
>>
>> Hi,
>> Can you point to some link that provide sample code or utility to clean
>> the Hibernate POJO (Hibernate Cleaner class) as you have mentioned in this
>> mail. It would greately help me too.
>>
>> Thanks in advance,
>>
>> Nagin
>> 2011/1/26 Néstor Boscán 
>>
>>>  This is very tipical in Hibernate applications that have to serialize
>>> objects through the network be it GWT, Web Services, JSON, etc. Hibernate
>>> will leave his own POJO in your objects for lazy initialization purposes.
>>> When GWT or a Web Service tries to serialize the objects and opens the
>>> hibernate POJO it will throw LazyInitializationException because the
>>> connection is already closed. What I've done in my applications is to clean
>>> the POJO of any Hibernate references. This is done with a Hibernate Cleaner
>>> class. On the web there are a couple of examples of this.
>>>
>>> Regards,
>>>
>>> Néstor Boscán
>>>
>>> On Tue, Jan 25, 2011 at 2:33 PM, Debashish wrote:
>>>
 Hi

 I am trying for a sample using GWT and database layer as Hibernate
 with Oracle on Google Aps server.

 I have done a sample for Hibernate with JSP as presentation layer,
 which is working fine.
 But the same approach is not working with GWT.

 Here is a verygood link on this topic

 http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
 and my approach is almost similar.

 I have followed the below approach,
 The RemoteServiceServlet makes a call to Hibernate layer and tries the
 initializes the SessionFactory as below,
  sessionFactory = new
 Configuration().configure().buildSessionFactory();

 I have added the jars necessary for the Hibernate layer (and
 classes12.jar for oracle driver).

 However while running , it is giving me an error as below,

 
 Initial SessionFactory creation failed.java.lang.NoClassDefFoundError:
 java.net.Socket is a restricted class. Please see the Google  App
 Engine developer's guide for more details.
 [ERROR] javax.servlet.ServletContext log: Exception while dispatching
 incoming RPC call
 com.google.gwt.user.server.rpc.UnexpectedException: Service method
 'public abstract java.lang.Long

 com.google.musicstore.client.MusicStoreService.saveAccount(com.google.musicstore.client.dto.AccountDTO)'
 threw an unexpected exception: java.lang.ExceptionInInitializerError
at
 com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
 378)

 
 I have one through some of the threads which suggested me to download
 the google apps jar files and try it. I have downladed it. but there
 is no proper direction on how to make use of which jar file.

 Have anybody tried the same. Please let me know if anything I am doing
 wrong.
 *** Note that I am using Oracle 9.2 as local database.

 Thanks
 Dev

 --
 You received this message because you are subscribed to the Google
 Groups "Google Web Toolkit" group.
 To post to this group, send email to
 google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.


>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Google Web Toolkit" group.
>>> To post to this group, send email to google-web-toolkit@googlegroups.com
>>> .
>>> To unsubscribe from this group, send email to
>>> google-web-toolkit+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>>
>>
>> --
>>   You received this message because you are subscribed to the Google
>> Groups "Google Web Toolkit" group.
>> To post to this group, send email to google-web-toolkit@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-web-toolkit+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>
>   --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more opt

Re: GWT with Hibernate and Oracle

2011-01-27 Thread Néstor Boscán
I found this one on the web:

http://maherkilani.blogspot.com/2008/12/hibernate-proxy-cleaner.html

Regards,

Néstor Boscán

On Thu, Jan 27, 2011 at 2:15 AM, Nagin Kothari wrote:

>
> Hi,
> Can you point to some link that provide sample code or utility to clean the
> Hibernate POJO (Hibernate Cleaner class) as you have mentioned in this mail.
> It would greately help me too.
>
> Thanks in advance,
>
> Nagin
> 2011/1/26 Néstor Boscán 
>
>> This is very tipical in Hibernate applications that have to serialize
>> objects through the network be it GWT, Web Services, JSON, etc. Hibernate
>> will leave his own POJO in your objects for lazy initialization purposes.
>> When GWT or a Web Service tries to serialize the objects and opens the
>> hibernate POJO it will throw LazyInitializationException because the
>> connection is already closed. What I've done in my applications is to clean
>> the POJO of any Hibernate references. This is done with a Hibernate Cleaner
>> class. On the web there are a couple of examples of this.
>>
>> Regards,
>>
>> Néstor Boscán
>>
>> On Tue, Jan 25, 2011 at 2:33 PM, Debashish wrote:
>>
>>> Hi
>>>
>>> I am trying for a sample using GWT and database layer as Hibernate
>>> with Oracle on Google Aps server.
>>>
>>> I have done a sample for Hibernate with JSP as presentation layer,
>>> which is working fine.
>>> But the same approach is not working with GWT.
>>>
>>> Here is a verygood link on this topic
>>>
>>> http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
>>> and my approach is almost similar.
>>>
>>> I have followed the below approach,
>>> The RemoteServiceServlet makes a call to Hibernate layer and tries the
>>> initializes the SessionFactory as below,
>>>  sessionFactory = new
>>> Configuration().configure().buildSessionFactory();
>>>
>>> I have added the jars necessary for the Hibernate layer (and
>>> classes12.jar for oracle driver).
>>>
>>> However while running , it is giving me an error as below,
>>>
>>> 
>>> Initial SessionFactory creation failed.java.lang.NoClassDefFoundError:
>>> java.net.Socket is a restricted class. Please see the Google  App
>>> Engine developer's guide for more details.
>>> [ERROR] javax.servlet.ServletContext log: Exception while dispatching
>>> incoming RPC call
>>> com.google.gwt.user.server.rpc.UnexpectedException: Service method
>>> 'public abstract java.lang.Long
>>>
>>> com.google.musicstore.client.MusicStoreService.saveAccount(com.google.musicstore.client.dto.AccountDTO)'
>>> threw an unexpected exception: java.lang.ExceptionInInitializerError
>>>at
>>> com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
>>> 378)
>>>
>>> 
>>> I have one through some of the threads which suggested me to download
>>> the google apps jar files and try it. I have downladed it. but there
>>> is no proper direction on how to make use of which jar file.
>>>
>>> Have anybody tried the same. Please let me know if anything I am doing
>>> wrong.
>>> *** Note that I am using Oracle 9.2 as local database.
>>>
>>> Thanks
>>> Dev
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Google Web Toolkit" group.
>>> To post to this group, send email to google-web-toolkit@googlegroups.com
>>> .
>>> To unsubscribe from this group, send email to
>>> google-web-toolkit+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To post to this group, send email to google-web-toolkit@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-web-toolkit+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: GWT with Hibernate and Oracle

2011-01-27 Thread Néstor Boscán
I'll send you my version:

package hibernate;

import java.beans.PropertyDescriptor;

import java.io.InputStream;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.List;

import org.apache.commons.beanutils.PropertyUtils;

import org.hibernate.EntityMode;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.proxy.HibernateProxyHelper;

import java.io.Serializable;

import java.sql.Blob;

import java.util.*;

import org.apache.log4j.Logger;

import org.hibernate.proxy.HibernateProxy;

public class HibernateCleaner {
private static final Logger logger =
Logger.getLogger(HibernateCleaner.class);

public static Object clean(Session session, Object obj) throws Exception
{
return (clean(session, obj, new HashMap()));
}

private static Object clean(Session session,
Object obj,
Map visitedObjects) throws
Exception {
Object newObj;
Map.Entry m;
Class clazz;
Object[] array;
Collection collection;
Map map;
PropertyDescriptor[] descriptors;
String property;
ClassMetadata clazzMetaData;
int index, length, hashCode;

if (obj == null)
return (null);

if ((obj instanceof Boolean) || (obj instanceof Number) ||
(obj instanceof Character) || (obj instanceof String) ||
(obj instanceof Blob) || (obj instanceof InputStream))
return (obj);

if (obj instanceof Date)
return (new Date (((Date) obj).getTime()));

if (obj instanceof Calendar)
return (((Calendar) obj).clone());

if (obj instanceof Object[]) {
array = (Object[]) ((Object[]) obj).clone();
length = array.length;
for (index = 0; index < length; index++)
array[index] = clean(session, array[index], visitedObjects);

return (array);
}

if (obj instanceof Object[]) {
array = (Object[]) ((Object[]) obj).clone();
length = array.length;
for (index = 0; index < length; index++)
array[index] = clean(session, array[index], visitedObjects);

return (array);
}

if (obj instanceof Collection) {
collection = createCollection((Collection) obj);

if (Hibernate.isInitialized(obj)) {
for (Object member: (Collection) obj)
collection.add (clean(session, member, visitedObjects));
}

return (collection);
}

if (obj instanceof Map) {
map = createMap((Map) obj);

if (Hibernate.isInitialized(obj)) {
for (Object member: ((Map)obj).entrySet()) {
m = (Map.Entry) member;
clean(session, m.getKey(), visitedObjects);
clean(session, m.getValue(), visitedObjects);
map.put (m.getKey(), m.getValue());
}
}

return (map);
}

hashCode = System.identityHashCode(obj);
if (visitedObjects.containsKey(hashCode))
return visitedObjects.get(hashCode);

if (obj instanceof HibernateProxy) {
clazz =
HibernateProxyHelper.getClassWithoutInitializingProxy(obj);
newObj = clazz.newInstance();
}
else
newObj = obj.getClass().newInstance();

visitedObjects.put(hashCode, newObj);

if (!Hibernate.isInitialized(obj)) {
if (session != null) {
clazzMetaData =
session.getSessionFactory().getClassMetadata(newObj.getClass());
Serializable id = clazzMetaData.getIdentifier(obj,
EntityMode.POJO);
clazzMetaData.setIdentifier(newObj, id, EntityMode.POJO);
}
} else {
descriptors = PropertyUtils.getPropertyDescriptors(newObj);
length = descriptors.length;
for (index = 0; index < length; index++) {
property = descriptors[index].getName();
if (!property.equals("class")) {
try {
PropertyUtils.setProperty(newObj, property,
  clean(session,
PropertyUtils.getProperty(obj, property), visitedObjects));
} catch (NoSuchMethodException e) {
}
}
}
}

return (newObj);
}

private static Collection createCollection(Collection obj) throws
Exception {
Collection newObj = null;

if (obj instanceof SortedSet)
newObj = new TreeSet ();
else if (obj instanceof Set)
newObj = new HashSet ();
else
   

Re: GWT with Hibernate and Oracle

2011-01-26 Thread Nagin Kothari
Hi,
Can you point to some link that provide sample code or utility to clean the
Hibernate POJO (Hibernate Cleaner class) as you have mentioned in this mail.
It would greately help me too.

Thanks in advance,

Nagin
2011/1/26 Néstor Boscán 

> This is very tipical in Hibernate applications that have to serialize
> objects through the network be it GWT, Web Services, JSON, etc. Hibernate
> will leave his own POJO in your objects for lazy initialization purposes.
> When GWT or a Web Service tries to serialize the objects and opens the
> hibernate POJO it will throw LazyInitializationException because the
> connection is already closed. What I've done in my applications is to clean
> the POJO of any Hibernate references. This is done with a Hibernate Cleaner
> class. On the web there are a couple of examples of this.
>
> Regards,
>
> Néstor Boscán
>
> On Tue, Jan 25, 2011 at 2:33 PM, Debashish  wrote:
>
>> Hi
>>
>> I am trying for a sample using GWT and database layer as Hibernate
>> with Oracle on Google Aps server.
>>
>> I have done a sample for Hibernate with JSP as presentation layer,
>> which is working fine.
>> But the same approach is not working with GWT.
>>
>> Here is a verygood link on this topic
>>
>> http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
>> and my approach is almost similar.
>>
>> I have followed the below approach,
>> The RemoteServiceServlet makes a call to Hibernate layer and tries the
>> initializes the SessionFactory as below,
>>  sessionFactory = new
>> Configuration().configure().buildSessionFactory();
>>
>> I have added the jars necessary for the Hibernate layer (and
>> classes12.jar for oracle driver).
>>
>> However while running , it is giving me an error as below,
>>
>> 
>> Initial SessionFactory creation failed.java.lang.NoClassDefFoundError:
>> java.net.Socket is a restricted class. Please see the Google  App
>> Engine developer's guide for more details.
>> [ERROR] javax.servlet.ServletContext log: Exception while dispatching
>> incoming RPC call
>> com.google.gwt.user.server.rpc.UnexpectedException: Service method
>> 'public abstract java.lang.Long
>>
>> com.google.musicstore.client.MusicStoreService.saveAccount(com.google.musicstore.client.dto.AccountDTO)'
>> threw an unexpected exception: java.lang.ExceptionInInitializerError
>>at
>> com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
>> 378)
>>
>> 
>> I have one through some of the threads which suggested me to download
>> the google apps jar files and try it. I have downladed it. but there
>> is no proper direction on how to make use of which jar file.
>>
>> Have anybody tried the same. Please let me know if anything I am doing
>> wrong.
>> *** Note that I am using Oracle 9.2 as local database.
>>
>> Thanks
>> Dev
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To post to this group, send email to google-web-toolkit@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-web-toolkit+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: GWT with Hibernate and Oracle

2011-01-26 Thread Néstor Boscán
This is very tipical in Hibernate applications that have to serialize
objects through the network be it GWT, Web Services, JSON, etc. Hibernate
will leave his own POJO in your objects for lazy initialization purposes.
When GWT or a Web Service tries to serialize the objects and opens the
hibernate POJO it will throw LazyInitializationException because the
connection is already closed. What I've done in my applications is to clean
the POJO of any Hibernate references. This is done with a Hibernate Cleaner
class. On the web there are a couple of examples of this.

Regards,

Néstor Boscán

On Tue, Jan 25, 2011 at 2:33 PM, Debashish  wrote:

> Hi
>
> I am trying for a sample using GWT and database layer as Hibernate
> with Oracle on Google Aps server.
>
> I have done a sample for Hibernate with JSP as presentation layer,
> which is working fine.
> But the same approach is not working with GWT.
>
> Here is a verygood link on this topic
>
> http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
> and my approach is almost similar.
>
> I have followed the below approach,
> The RemoteServiceServlet makes a call to Hibernate layer and tries the
> initializes the SessionFactory as below,
>  sessionFactory = new
> Configuration().configure().buildSessionFactory();
>
> I have added the jars necessary for the Hibernate layer (and
> classes12.jar for oracle driver).
>
> However while running , it is giving me an error as below,
>
> 
> Initial SessionFactory creation failed.java.lang.NoClassDefFoundError:
> java.net.Socket is a restricted class. Please see the Google  App
> Engine developer's guide for more details.
> [ERROR] javax.servlet.ServletContext log: Exception while dispatching
> incoming RPC call
> com.google.gwt.user.server.rpc.UnexpectedException: Service method
> 'public abstract java.lang.Long
>
> com.google.musicstore.client.MusicStoreService.saveAccount(com.google.musicstore.client.dto.AccountDTO)'
> threw an unexpected exception: java.lang.ExceptionInInitializerError
>at
> com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
> 378)
>
> 
> I have one through some of the threads which suggested me to download
> the google apps jar files and try it. I have downladed it. but there
> is no proper direction on how to make use of which jar file.
>
> Have anybody tried the same. Please let me know if anything I am doing
> wrong.
> *** Note that I am using Oracle 9.2 as local database.
>
> Thanks
> Dev
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



GWT with Hibernate and Oracle

2011-01-25 Thread Debashish
Hi

I am trying for a sample using GWT and database layer as Hibernate
with Oracle on Google Aps server.

I have done a sample for Hibernate with JSP as presentation layer,
which is working fine.
But the same approach is not working with GWT.

Here is a verygood link on this topic
  
http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html
and my approach is almost similar.

I have followed the below approach,
The RemoteServiceServlet makes a call to Hibernate layer and tries the
initializes the SessionFactory as below,
  sessionFactory = new
Configuration().configure().buildSessionFactory();

I have added the jars necessary for the Hibernate layer (and
classes12.jar for oracle driver).

However while running , it is giving me an error as below,

Initial SessionFactory creation failed.java.lang.NoClassDefFoundError:
java.net.Socket is a restricted class. Please see the Google  App
Engine developer's guide for more details.
[ERROR] javax.servlet.ServletContext log: Exception while dispatching
incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract java.lang.Long
com.google.musicstore.client.MusicStoreService.saveAccount(com.google.musicstore.client.dto.AccountDTO)'
threw an unexpected exception: java.lang.ExceptionInInitializerError
at
com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
378)

I have one through some of the threads which suggested me to download
the google apps jar files and try it. I have downladed it. but there
is no proper direction on how to make use of which jar file.

Have anybody tried the same. Please let me know if anything I am doing
wrong.
*** Note that I am using Oracle 9.2 as local database.

Thanks
Dev

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.