Results 1 to 2 of 2
  1. #1
    Kkenjoy is offline Member
    Join Date
    Apr 2013
    Posts
    7
    Rep Power
    0

    Default Enterprise Application Project and returning object from EJB using EJBClient

    Greetings,

    So my problem is the following:

    I'm using eclipse indigo, and i created a Enterprise Application Project called xxxEar. Then i created a EJB project (xxxEjb) adding it to the EAR project and creating the EJB Client Jar module to hold the client interfaces and classes (xxxEjbClient, xxxEjbClient.jar).

    What i want with this is that every time i want to access the classes of the xxxEjb, i will do it using the interfaces in xxxEjbClient.

    Now... in the xxxEjb i have 3 classes:

    a simple User entity
    Java Code:
    @Entity
    public class User {
       ...
    }
    a UserCatalog to access the database

    Java Code:
    @Stateless
    @LocalBean //no interface
    public class UserCatalog {
        
        @PersistenceContext
        private EntityManager em;
         
     
        public void addUser(....) { ... }
     
        public User getUser(....) { ... }
    }
    and a UserHandler that implements the interface UserHandlerLocal of xxxEjbClient.

    Java Code:
    @Stateless
    public class UserHandler implements UserHandlerLocal {
     
        @EJB
        private UserCatalog userCatalog;
     
            public User getUser(...) {...}  
     
            public void addUser(...) {...}
    
    }
    in the xxxEjbClient project i have the interface:

    Java Code:
    @Local
    public interface UserHandlerLocal {
     
            public void addUser(...) {...}
     
            public User getUser(...) {...}  // error! doesnt recognize User class
     
    }
    now here is the problem... The interface in the xxxEjbClient doesnt recognize the class User! I also have a Dynamic web application in the xxxEar and its all working to add the user in the database. Now after i added users i was going to implement the getUser(...) but to be honest i don't know how to do this... Is there a way to make the interface know the class User? Or do i have to make the method to return a Object so i can use in the web application?

    Any tips? Thanks in advanced ^^

  2. #2
    Kkenjoy is offline Member
    Join Date
    Apr 2013
    Posts
    7
    Rep Power
    0

    Default Re: Enterprise Application Project and returning object from EJB using EJBClient

    The only progress i made was that it seems the xxxEjbClient.jar isn't updating with the entity User i am creating in the xxxEjb.
    Anyone knows how to do it? Shouldn't it be automatic?

Similar Threads

  1. Replies: 0
    Last Post: 04-08-2013, 10:48 PM
  2. Enterprise application example
    By dmis in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 07-15-2008, 07:15 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •