-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: hibernate3.jar in client-side classpath?
PostPosted: Thu Aug 11, 2005 3:42 am 
Newbie

Joined: Tue May 03, 2005 11:53 am
Posts: 7
Hello,
I've a swing client that make calls to session bean on a JEE server (jonas).
On my client I've this error:

Code:
java.rmi.UnmarshalException: ClassNotFoundException unmarshalling returnjava.lang.ClassNotFoundException: org.hibernate.collection.PersistentSet (no security manager: RMI class loader disabled)
   at org.objectweb.carol.rmi.jrmp.server.JUnicastRef.invoke(JUnicastRef.java:178)
   at test.interfaces.JOnASAdminSession739595833Remote_Stub.getAllUsers(Unknown Source)


Here is my session bean code:
Code:
public Collection getAllUsers() throws BusinessException {
      Collection users = null;
      try {
         init();
         session.connect();
         users = userDAO.findAll();
      } finally {
         session.disconnect();
      }
      return users;
   }


And here is my dao code:
Code:
   public Collection findAll() throws InfrastructureException {
      Collection users;
      try {
         users = session.createCriteria(User.class).list();
      } catch (HibernateException ex) {
         throw new InfrastructureException(ex);
      }
      return users;
   }



If I put the hibernate3.jar in the client's classpath all work fine.
Is there a way to avoid to put this jar on the client?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 4:13 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Looks like you are using PersistentSet
in your classes. If you transport them to
the client you certainly need hibernate.jar.
If you do not want that dependency, you
need to use java.util.HashSet and so on
as collection classes.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 4:35 pm 
Beginner
Beginner

Joined: Thu Feb 17, 2005 9:20 pm
Posts: 36
Location: Vancouver, WA
I suggest you rethink your approach if possible and use transfer objects instead. Do no use POJOs to trasport data to a client. Or your client can become very "fat". Hibernate behind scene can use own implementations behind interfaces that you will be using for data access.

_________________
Vasyl Zhabko


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 4:52 pm 
Newbie

Joined: Tue May 03, 2005 11:53 am
Posts: 7
thank for your replies.
I going to rethink the architecture of my program but I'm new in hibernate.
But I don't undertand anyway my error. I've modified the code of my DAO :
Code:
public Collection findAll() throws InfrastructureException {
      Collection users;
      try {
         users = new ArrayList(session.createCriteria(User.class).list());
      } catch (HibernateException ex) {
         throw new InfrastructureException(ex);
      }
      return users;
}


So my DAO return an ArrayList, but I've the same error!
I think it should be possible to have a heavy client whitout the hibernate.jar? Any experiences?

Thanks.


Top
 Profile  
 
 Post subject: other collections?
PostPosted: Thu Aug 11, 2005 5:27 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Does your User object holds any persistent collections by any chance? If so then you will need to convert them to standard Java collections too.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 7:01 pm 
Beginner
Beginner

Joined: Thu Feb 17, 2005 9:20 pm
Posts: 36
Location: Vancouver, WA
Your user object can reference other objects. Those objects can reference others and so on .... You can have trouble not with user itself but with associated objects. It depends how you have mapped all of that. If you provide your mappings then it may be possible to say where source of problem.

_________________
Vasyl Zhabko


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

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.