使用JPA SYSCS_BACKUP_DATABASE和EntityManager / Backup

时间:2014-07-31 21:39:29

标签: java sql jpa derby

如何使用EntityManager(也使用JPA)执行online derby backup

我最近的代码无法正常运行。

StoredProcedureQuery query = em.createStoredProcedureQuery("SYSCS_UTIL.SYSCS_BACKUP_DATABASE");
        query.registerStoredProcedureParameter(1, java.lang.String.class, ParameterMode.IN);
        query.setParameter(1, "pathToDBBackup");
        query.execute();

我得到的错误如下。

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: The exception 'java.lang.ClassCastException: java.nio.file.NoSuchFileException cannot be cast to java.lang.RuntimeException' was thrown while evaluating an expression.
Error Code: 20000
Call: CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE(?)
    bind => [1 parameter bound]
Query: ResultSetMappingQuery()
    at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340)
    at ...
Caused by: java.sql.SQLException: The exception 'java.lang.ClassCastException: java.nio.file.NoSuchFileException cannot be cast to java.lang.RuntimeException' was thrown while evaluating an expression.
    at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
    at ... 
Caused by: org.apache.derby.client.am.SqlException: The exception 'java.lang.ClassCastException: java.nio.file.NoSuchFileException cannot be cast to java.lang.RuntimeException' was thrown while evaluating an expression.
    at org.apache.derby.client.am.Statement.completeExecute(Unknown Source)
    at ...
Caused by: org.apache.derby.client.am.SqlException: Java exception: 'java.nio.file.NoSuchFileException cannot be cast to java.lang.RuntimeException: java.lang.ClassCastException'.
    ... 

1 个答案:

答案 0 :(得分:0)

如果指定现有目录的完整路径作为过程的参数,它是否有效?

NoSuchFileException指向那个方向。