To store posts and comments in a database, we added the jpox persistence module at the beginning, but now we have to indicate persistent classes and their dependences in package.jdo file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jdo PUBLIC
"-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN"
"jdo.dtd">
<jdo>
<package name="org.romulus.blog.domain">
<class name="Post" detachable="true">
<field name="comments" default-fetch-group="true">
<collection element-type="Comment" />
</field>
</class>
<class name="Comment" detachable="true"/>
</package>
</jdo>
Next step is to create CRUD classes using the Roma console with the following commands:
./roma.sh crud org.romulus.blog.domain.Post
./roma.sh crud org.romulus.blog.domain.Comment
If we refresh the Eclipse project, we observe the new classes under org.romulus.blog.view.domain.post and org.romulus.blog.view.domain.comment packages, respectively.
0 Ficheros adjuntos