0 Replies Latest reply on Oct 11, 2004 8:26 AM by Bill Burke

    Something make me confuse in the EJB3 examples !!!

    Bill Burke Master


      "ericmacau" wrote:

      I just download the EJB3 preview and try to run the examples, those are works fine. But I have something misunderstood.

      1. There is a target "entity2xml"

       <target name="entity2xml" depends="prepare">
       <java fork="yes" failOnError="true" className="org.jboss.ejb3.entity.EntityToHibernateXml">
       <classpath refid="classpath"/>
       <arg value="org.jboss.tutorial.entity.bean.Order"/>
       <arg value="org.jboss.tutorial.entity.bean.LineItem"/>

      Sorry, this was to debug some problems I was having during development. What EntityToHibernateXml actually does is generate a Hibernate 3.0 XML file. Our EJB 3.0 implemenation is built on top of Hibernate.

      - What is the output and where does it locate ? But not all the build.xml includes this, only in entity example, why? And when need to use this "entity2xml" ??

      It outputs to stdout. You don't need to use this target unless you're interested in the Hibernate mapping

      2. The following is cut from Customer.java in relationships folder,

      @OneToOne(cascade = {CascadeType.ALL})
      @JoinColumn(name = "ADDRESS_ID")
      public Address getAddress()
      return address;

      - I checked the Address.java, it only has the following tag:
      @Id(generate = GeneratorType.IDENTITY)
      public Long getId()
      return id;

      - How can it know it is the ADDRESS_ID, or can I use different name, such as ADDR_ID ???

      Open up the Hypersonic SQL manager GUI as specified in the directions. You'll be able to see what the tables look like. In this example, an "ADDRESS_ID" column is created on Customer. Yes, you can name the column anything you like.

      Is there any document to describe the usage of all the TAGS ???


      Unfortunately, only the EJB 3.0 specification has a description of all the annotations. It comes with the distribution.