0

I want to create a new table using OpenJPA in the source code of Apache ODE. I have created an interface and provided an implementation. I compiled the process using Maven and deployed it on Apache Tomcat. However when I run a BPEL process on the Apache ODE engine, I get the error:

org.apache.openjpa.persistence.PersistenceException: Table/View 'ODE_POLICY_ATTACHMENT' does not exist.

I have added my PolicyAttachmentDAOImpl class in ApacheODE\dao-jpa\src\main\resources\META-INF\persistence.xml

persistence xmlns="http://java.sun.com/xml/ns/persistence"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         version="1.0">
<persistence-unit name="ode-dao">
    <!-- 
        This properties file is used specifically by the
        OpenJPA Enhancer.
     -->
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <class>org.apache.ode.dao.jpa.ProcessDAOImpl</class>
    <class>org.apache.ode.dao.jpa.PolicyAttachmentDAOImpl</class>
    .............................................................
</persistence-unit>

My DAO(Data Access Object) interface:

public interface PolicyAttachmentDAO {

 /**
 * Get the process.
 * 
 * @return process reference.
 */
 ProcessDAO getProcess();

 ...............
}

Then I have implemented it in a class like this:

@Entity
@Table(name = "ODE_POLICY_ATTACHMENT")
/**
 * 
 *       OpenJPA implementation of the {@link PolicyAttachmentDAO} interface.
 * 
 */
public class PolicyAttachmentDAOImpl extends OpenJPADAO implements PolicyAttachmentDAO{
@Id
@Column(name = "POLICYATTACHMENT_ID")
@GeneratedValue(strategy = GenerationType.AUTO)
private Long _attachmentId;

@ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
@Column(name = "PROCESS_ID")
private ProcessDAOImpl _process;

@Basic
@Column(name = "POLICYATTACHMENT_NAME")
private String _attachmentName;

@Basic
@Column(name = "POLICYATTACHMENT_FILE_DATE")
private Date _attachmentFileDate;

    public PolicyAttachmentDAOImpl(ProcessDAOImpl process, String policyAttachmentName, Date attachmentFileDate) {
      _process = process;
      _attachmentName = policyAttachmentName;
      _attachmentFileDate = attachmentFileDate;
    }

     public ProcessDAO getProcess() {
      return _process;
}

  .....................
 }

Can anyone guide me how to create the table?

Thanks! Peter

Peter
  • 213
  • 2
  • 5
  • 14

1 Answers1

0

I have managed to generate my table. There are more persistence.xml files in the source code of Apache ODE and I have not edited the right one. After adding my PolicyAttachmentDAOImpl class to ApacheODE\dao-jpa-ojpa-derby\src\test\resources\META-INF\persistence.xml the table was created.

Peter
  • 213
  • 2
  • 5
  • 14