0
votes

I intend creating a restful webservices with spring and Datanucleus JDO for persistence. I have read a couple of materials and i think i understand safe for some grey areas. I have created my domain/Model classes but unsure of certain things. Here are my questions

1) Is it possible to annotate my persistent Classes with @XmlRootElement and @PersistenceCapable. I ask this because the same persistent classes will be marshalled and unmarshalled to and from xml. For example

@PersistenceCapable
@XmlRootElement(name="miscode")
public class MisCode {

}

2) I already have a database i need to connect to, so how do i map each Model e.g(MisCode.java) class to it's corresponding table name in the database. Is the .orm file necessary and where do i put it?

3) Is persistence.xml necessary and where does it come in?

Thank you all.

1

1 Answers

1
votes
  1. Why wouldn't two independent annotations be usable?

  2. Why not read the docs for DataNucleus about how to map to a schema? http://www.datanucleus.org/products/accessplatform_3_0/jdo/orm/schema_mapping.html

  3. No. As above, read the docs of the JDO implementation you chose, or read the JDO spec.