facebook

XDoclet generates a Collection wo the import [Closed]

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #223721 Reply

    drowell
    Member

    – System Setup ——————————-
    Operating System and version: Linux Redhat Fedora Core
    Eclipse version: 3.0.1
    Eclipse build id: 20040961125
    Fresh Eclipse install (y/n): y
    If not, was it upgraded to its current version using the update manager?
    Other installed external plugins:
    Number of plugins in the <eclipse>/plugins directory that begin with org.eclipse.pde.*:
    MyEclipse version: 3.8.3
    Eclipse JDK version: 1.4.2
    Application Server JDK version: 1.4.2
    Are there any exceptions in the Eclipse log file? None

    David Rowell
    drowell@settimogroup.com
    davidallanrowell@hotmail.com

    Our development team is creating EJB Data Objects, also referred to as Value Objects. When XDoclet generates the java file, the code contains a Collection variable that gives off an error that the Collection type cannot be found. Essentially the XDoclet generated file is not bringing in “import java.util.Collection”

    How do we get XDoclet to generate Value Object java files correctly when the generated java file contains Collections.

    Also note that our other code, that we create, is able to use Collections successfully, so we have our j2se setup correctly.

    Any help is greatly appreciated.

    David Rowell
    drowell@settimogroup.com
    davidallanrowell@hotmail.com

    #223747 Reply

    Riyad Kalla
    Member

    David,
    I remember something like this with another gentleman, and it was an issue of him setting the value type to “java.util.List” instead of, for example, “List” in his XDoclet tags before running XDoclet… is this a similar case with you? Can you provide a code snippet for us to see and pour over?

    #223786 Reply

    drowell
    Member

    I have provided a code snippet below:

    Visitor.java file

    /**

    * @ejb.value-object

    * aggregate=”com.hobsons.nafsa.model.entity.interfaces.CountryValue”

    * aggregate-name=”IntrestedCountry”

    * members=”com.hobsons.nafsa.model.entity.interfaces.CountryLocal”

    * members-name=”IntrestedCountry”

    * relation=”external”

    * type=”Collection”

    *

    * @ejb.relation

    * name=”Visitor-Interest-Country”

    * role-name=”visitor-has-country”

    * @jboss.relation related-pk-field=”visitorId”

    * fk-column=”countryId”

    * @jboss.relation-table table-name=”VisitorInterestCountry”

    * create-table=”true”

    * delete-table=”true”

    */

    public abstract java.util.Collection getInterestCountry();

    VistorValue.java file

    private java.lang.String orgName;

    private boolean orgNameHasBeenSet = false;

    private java.lang.String country2Id;

    private boolean country2IdHasBeenSet = false;

    private Collection IntrestedCountrys = new java.util.ArrayList();

    The type Collection is not defined

    #223787 Reply

    drowell
    Member

    Based upon your response, are you saying that the last line in the code snippet should be:

    private Collection InterestedCountrys = new ArrayList(); instead of
    private Collection IntrestedCountrys = new java.util.ArrayList();
    ?

    #223791 Reply

    Riyad Kalla
    Member

    Actually no, this was the same problem he had, he had to change this:

    
     /**
    
    * @ejb.value-object
    
    * aggregate="com.hobsons.nafsa.model.entity.interfaces.CountryValue"
    
    * aggregate-name="IntrestedCountry"
    
    * members="com.hobsons.nafsa.model.entity.interfaces.CountryLocal"
    
    * members-name="IntrestedCountry"
    
    * relation="external"
    
    * type="Collection" 
    <snip>
    

    To this:

    
     /**
    
    * @ejb.value-object
    
    * aggregate="com.hobsons.nafsa.model.entity.interfaces.CountryValue"
    
    * aggregate-name="IntrestedCountry"
    
    * members="com.hobsons.nafsa.model.entity.interfaces.CountryLocal"
    
    * members-name="IntrestedCountry"
    
    * relation="external"
    
    * type="java.util.Collection" 
    <snip>
    

    (note the last line)

    You should be able to import the classes in the Java code and just use their short names, but for the tags and generated XML descriptor you need to fully qualify the class name, which is why you need to change that value in your XD tag.

    #223817 Reply

    drowell
    Member

    That was the problem. Thank you very much. Your support is superior.

    #223827 Reply

    Riyad Kalla
    Member

    That was the problem. Thank you very much. Your support is superior.

    Glad it worked, and thank you.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: XDoclet generates a Collection wo the import [Closed]

You must be logged in to post in the forum log in