facebook

[Closed]XDoclet generating bad Hibernate xml files

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #247794 Reply

    gvcite
    Member

    Hi,

    I’m using MyEclipse 4.1.0, and I have the following Hibernate XDoclet tags in one of my methods (in the class “Customer”):

    
        /**
         * Get the customer's orders
         *
         * @hibernate.set     order-by="order_id"
         *                    cascade="all-delete-orphan"
         * @hibernate.collection-key
         *                    column="customer_id"
         * @hibernate.collection-one-to-many
         *                    class="com.cite.paypaltest.Order"
         * 
         * @return The set of orders for this customer
         */
        public Set<Order> getOrders() {
           return(orders);
        }
    

    It generates the following Customer.hbm.xml :

    
           <set
                role="orders"
                lazy="false"
                readonly="false"
                cascade="all-delete-orphan"
                sort="unsorted"
                order-by="order_id"
            >
                <key
                    column="customer_id"
                >
                </key>
                <one-to-many
                      class="com.cite.paypaltest.Order"
                />
            </set>
    

    An error is reported by the XML viewer, which says that “role” and “readonly” are not valid attributes for “set”, and that “name” is a required attribute. If I manually change “role” to “name” and eliminate “readonly” attribute, it works ok. Perhaps the problem is just an invalid DTD, but I’m not sure how to determine which DTD it’s using. I’m using “dynamically generated” xdoclet build, not the “xdoclet-build.xml” file.

    Any help would be greatly appreciated. Thank you.

    Gene

    #247821

    osesm
    Member

    Did you forget to set the hibernate version? By default xdoclet generates hibernate 2 mappings I believe.

    #248377

    gvcite
    Member

    Since I’m not using an xdoclet-build.xml file, how can I set it to generate hibernate3 mappings? I didn’t find any MyEclipseIDE options for it under XDoclet preferences. Thanks in advance for your help.

    #248378

    osesm
    Member

    You add it as an option under your hibernate xdoclet settings. I assume you did the standard hibernate xdoclet configuration. The option you are looking for is version. You can set it to 3.0.

    #248689

    gvcite
    Member

    That seemed to work, thanks! It was not obvious how to get to that option, so for others’ use, it’s the following:

    – Click on the project
    – Right click or go to Project menu and get the Properties
    – Click on MyEclipse-XDoclet
    – Select the Standard (or whatever) Hibernate
    – Select “hibernate” properties on the bottom window
    – Select “version” in the list of properties, and type in “3.0” for the value

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: [Closed]XDoclet generating bad Hibernate xml files

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