Missing information using DAO

21 views
Skip to first unread message

Fulgencio Jara

unread,
Jul 31, 2013, 5:21:44 AM7/31/13
to jc...@googlegroups.com
Hi all,

I want to expose a problem I'm facing now with Jcrom DAO. I created a class that extends JcrFile:

   @JcrNode(nodeType = "nt:unstructured")
   public class Attachment extends JcrFile {

       @JcrProperty String attachmentType;
       @JcrProperty Map<String, String> customProperties;
       @JcrIdentifier String identifier;

        ...
   }

The class that contains this class is this one:

   public class DraftApplication {

      @JcrChildNode List<Attachment> attachments;

      ...
   }

I'm trying to get the information from the repository this way (using the DAO, of course):

   GenericDAO draftApplicationDAO = new GenericDAO(DraftApplication.class, rootNode.getSession(), jcrom);
   ...
   DraftApplication draftApplication = (DraftApplication) draftApplicationDAO.get(applicationType.getPath() + "/drafts/" + filingNumber);

And the generic DAO class is like this:

   public class GenericDAO extends AbstractJcrDAO {

      public GenericDAO(Class entityClass, Session session, Jcrom jcrom) {
         super(entityClass, session, jcrom);
      }
   }

THE PROBLEM: When I get a draftApplication from the repository, it gets all the attachments it has. But the attachments has only the properties i manually added in the Attachment class. JcrFile properties are not imported. So, when I try to add a new attachment and persist again the JcrFile properties are null in the retrieved attachments and, obviously, the application throws an exception.
Reply all
Reply to author
Forward
0 new messages