Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to define persistence using XML metadata and mark which are persistable #9

Closed
cloudSher opened this issue Aug 30, 2016 · 1 comment

Comments

@cloudSher
Copy link

In the JDO Tutorial, I define persistence using XML metadata,but the classes have not enhanced,
jdo tutorial

this is example:
`@PersistenceCapable
public class Product
{
// @PrimaryKey
// @Persistent(valueStrategy=IdGeneratorStrategy.NATIVE)
protected long id;

protected String name=null;

protected String description=null;

protected double price=0.0;

public Product(String name, String description, double price)
{
    this.name = name;
    this.description = description;
    this.price = price;
}

public long getId()
{
    return id;
}

public String getName()
{
    return name;
}

public String getDescription()
{
    return description;
}

public double getPrice()
{
    return price;
}

public void setName(String name)
{
    this.name = name;
}

public void setDescription(String description)
{
    this.description = description;
}

public void setPrice(double price)
{
    this.price = price;
}

public String toString()
{
    return "Product : " + id + " name=" + name + " [" + description + "]";
}

}`

like this, run successed, but I remove the “@PersistenceCapable” annotation,
how to define model classes using xml metadata?

In the sample project, I define package.jdo in resource like this:
`

    <class name="Product"   persistence-modifier="persistence-capable">
        <field name="id" />
        <field name="name" />
        <field name="description"/>
        <field name="price"/>
    </class>
</package>

`

using maven plugin
mvn datanucleus:enhance
result:
[INFO] DataNucleus Enhancer (version 5.0.1) for API "JDO" DataNucleus Enhancer completed with success for 0 classes. DataNucleus Enhancer completed and no classes were enhanced. Consult the log for full details

no classes were enhanced,so how to define persistence only using xml metadata?

@andyjefferson
Copy link
Member

This is the testsuite for DataNucleus. It is not the place for questions/problems. Use the forum or Stackoverflow for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants