1 Reply Latest reply on Feb 14, 2011 9:47 AM by peterj

    How to generate jaxws annotated class

    samwun9988

      Hello,

      I know I can handcraft web service annotation on an entity class, but I really want to make it as an automation.

      I am sure there is a way of automation to handle this, by using some sort of jaxws tools. You guys may know how this done.

       

      Here is an entity class (RoleHome.java) I want to put Jaxws annotation on it and then use the jaxws annotated class (eg. RoleHomeWS.java) to generate web services.


      package au.com.housewareonline.dao;

      // Generated 13/02/2011 10:57:42 PM by Hibernate Tools 3.4.0.CR1

      import javax.ejb.Stateless;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;

      /**
      * Home object for domain model class Role.
      * @see au.com.housewareonline.dao.Role
      * @author Hibernate Tools
      */
      @Stateless
      public class RoleHome {

      private static final Log log = LogFactory.getLog(RoleHome.class);

      @PersistenceContext
      private EntityManager entityManager;

      public void persist(Role transientInstance) {
      log.debug("persisting Role instance");
      try {
      entityManager.persist(transientInstance);
      log.debug("persist successful");
      } catch (RuntimeException re) {
      log.error("persist failed", re);
      throw re;
      }
      }

      public void remove(Role persistentInstance) {
      log.debug("removing Role instance");
      try {
      entityManager.remove(persistentInstance);
      log.debug("remove successful");
      } catch (RuntimeException re) {
      log.error("remove failed", re);
      throw re;
      }
      }

      public Role merge(Role detachedInstance) {
      log.debug("merging Role instance");
      try {
      Role result = entityManager.merge(detachedInstance);
      log.debug("merge successful");
      return result;
      } catch (RuntimeException re) {
      log.error("merge failed", re);
      throw re;
      }
      }

      public Role findById(long id) {
      log.debug("getting Role instance with id: " + id);
      try {
      Role instance = entityManager.find(Role.class, id);
      log.debug("get successful");
      return instance;
      } catch (RuntimeException re) {
      log.error("get failed", re);
      throw re;
      }
      }
      }

      Very appreciate for any suggestion and help.

      Thanks
      Sam