4 Replies Latest reply on Jan 27, 2012 3:33 AM by Ondra Chaloupka

    Package ejb2.1 entities along with ejb3.0 session deans

    Venkat koya Newbie

      Is it possible to have mixed version components in an ejb module?
      I mean can I jar ejb2.0 entities and ejb3.0 entities on one ejb module.
      I packaged one ejb3.0 session bean and two ejb2.0 entity beans. I did not see any error but It deployed only ejb3.0 session and not ejb2.0 entities?

        • 1. Re: Package ejb2.1 entities along with ejb3.0 session deans
          Eric Yip Newbie

          hi koyav,

          Did you ever find out the answer? If yes, can you let me know? I have to do similar thing....

          Thanks.

          • 2. Re: Package ejb2.1 entities along with ejb3.0 session deans
            arisa Newbie

            I too am researching mixing EJB 2.1 and 3.0 Beans in the same .jar file. I have verified that you can mix EJB2.1 SLSB and EJB3 SLSB in the same .jar file. Unit tests verified that they work perfectly together.

            HOWEVER, currently I am not able to mix EJB2.1 entities with EJB3 entities.

            * If persistence.xml is placed inside the .jar file, then the EJB3 deployer kicks in and only EJB3 entity beans are deployed.

            * If I remove the persistence.xml file, then the normal deployment takes place and only my EJB2.1 entity beans are deployed.

            It would be really really great if someone could shed light on this issue. I'm sure there are many of us who want to upgrade to EJB3 but can only do so partially (and is one of the objectives of EJB3 to allow interoperability if I'm not mistaken). It would be a problem if EJB2.1 and EJB3 entities had to be packaged in different .jar files as I would not be able to implement CMR between those entities.

            Thanks very much in advance.

            ps. sorry for the same posting to two different forum messages, as they are similar.

            • 3. Re: Package ejb2.1 entities along with ejb3.0 session deans
              Ben Walker Newbie

              Hi,

              Is there any progress on this? I think it is still a problem in jboss 5 beta 4.
              If you use the 2.0 dtd for your ejb-jar.xml file: -

              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
              <ejb-jar>
              ...
              

              all ejb 3 beans in the jar are ignored.

              Vice versa, if you use the ejb 3 schema for your ejb-jar.xml file: -
              <?xml version="1.0" encoding="UTF-8"?>
              <ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
              ...
              

              all ejb 2 beans are ignored

              Is it a mandatory to put different ejb versions in different ejb modules?

              • 4. Re: Package ejb2.1 entities along with ejb3.0 session deans
                Ondra Chaloupka Expert

                I have found this disscusion during my searching for the answer then the following link helped me:

                https://community.jboss.org/wiki/ReferenceEJB3BeansFromEJB2Beans