-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Using interfaces and XDoclet to generate xml and classes
PostPosted: Wed Feb 25, 2004 6:47 pm 
Beginner
Beginner

Joined: Wed Feb 25, 2004 6:23 pm
Posts: 39
We have some requirements for our project that will require us to access all persistent data via interfaces. In order to save time I'd like to drive both the generation of Hibernate mapping (xml) files and the actual Java classes that implement the persistent interfaces from XDoclet tags on the persistent interface. Here is an example:
Say I have a simple persistent interface:

Code:
package eg;

public interface Test
{
  public long getId();
  public void setId(long id);

  public String getName();
  public void setName(String name);
}


Since nothing special will be required of the XML or the Java, I'd love to just write the interface and be done with it. Let XDoclet generate the xml and Java code for me. Has anyone done anything like this?
I envision something like this:

Code:
package eg;

/**
* @hibernate.class table="test"
* @hibernate.generate-subclass name="eg.TestImpl"
*/
public interface Test
{
  /**
   * @hibernate.id unsaved-value="0" generator-class="native"
   */
  public long getId();
  public void setId(long id);

  /**
   * @hibernate.property
   */
  public String getName();
  public void setName(String name);
}


Notice how I put a @hibernate.generate-subclass tag in there along with the @hibernate.class.
Anyway, if, in the end all my .xml and generic .java Impl classes were autogenerated, I would be a happy camper. Has anyone done this, or does this even make sense?

- Anodos


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.