Package org.exolab.castor.jdo

Examples of org.exolab.castor.jdo.PersistenceException


                        stmt.setNull(internalCount++, columns[j].getSqlType());
                    }
                } else if (value instanceof Identity) {
                    Identity identity = (Identity) value;
                    if (identity.size() != columns.length) {
                        throw new PersistenceException("Size of identity field mismatch!");
                    }
                    for (int j = 0; j < columns.length; j++) {
                        SQLTypeInfos.setValue(stmt, internalCount++,
                                columns[j].toSQL(identity.get(j)), columns[j].getSqlType());
                    }
                } else {
                    if (columns.length != 1) {
                        throw new PersistenceException("Complex field expected!");
                    }
                    SQLTypeInfos.setValue(stmt, internalCount++, columns[0].toSQL(value),
                            columns[0].getSqlType());
                }
            }
View Full Code Here


    throws PersistenceException {
        ConnectionFactory factory = null;
        try {
            factory = DatabaseRegistry.getConnectionFactory(database.getDatabaseName());
        } catch (MappingException e) {
            throw new PersistenceException(Messages.message("persist.cannotCreateSeparateConn"), e);
        }
       
        try {
            Connection conn = factory.createConnection();
            conn.setAutoCommit(false);
            return conn;
        } catch (SQLException e) {
            throw new PersistenceException(Messages.message("persist.cannotCreateSeparateConn"), e);
        }
    }
View Full Code Here

                }
                insertStatement.executeUpdate();
            }
        } catch (SQLException e) {
            e.printStackTrace();
            throw new PersistenceException(e.toString());
        } finally {
            JDOUtils.closeResultSet(rset);
            JDOUtils.closeStatement(selectStatement);
            JDOUtils.closeStatement(insertStatement);
        }
View Full Code Here

                count++;
            }
            stmt.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
            throw new PersistenceException(e.toString());
        } finally {
            JDOUtils.closeStatement(stmt);
        }
    }
View Full Code Here

                count++;
            }
            stmt.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
            throw new PersistenceException(e.toString());
        } finally {
            JDOUtils.closeStatement(stmt);
        }
    }
View Full Code Here

                }
                int r = insertStatement.executeUpdate();
            }
        } catch ( SQLException e ) {
            e.printStackTrace();
            throw new PersistenceException( e.toString() );
        } finally {
            try {
                if ( rset != null )
                    rset.close();
                if ( selectStatement != null )
View Full Code Here

                stmt.setObject( count, idToSQL( 0, leftValue ), leftType[0] );
            }
            int i = stmt.executeUpdate();
        } catch ( SQLException e ) {
            e.printStackTrace();
            throw new PersistenceException( e.toString() );
        } finally {
            try {
                if ( stmt != null )
                    stmt.close();
            } catch ( SQLException sqle ) { }
View Full Code Here

                stmt.setObject( count, ridToSQL( 0, rightValue ), rightType[0] );
            }
            int i = stmt.executeUpdate();
        } catch ( SQLException e ) {
            e.printStackTrace();
            throw new PersistenceException( e.toString() );
        } finally {
            try {
                if ( stmt != null )
                    stmt.close();
            } catch ( SQLException sqle ) { }
View Full Code Here

                typeInfo.rename( oid, newoid, tx );

                return newoid;
            } catch ( LockNotGrantedException e ) {
                e.printStackTrace();
                throw new PersistenceException( Messages.format("persist.nested","Key Generator Failure. Duplicated Identity is generated!") );
            } finally {
                if ( lock != null )
                    lock.confirm( tx, succeed );
            }
        }
View Full Code Here

                    _stmt.close();
                } catch ( SQLException e2 ) {
                    _log.warn (Messages.message ("persist.stClosingFailed"), e2);
                }
            }
            throw new PersistenceException( Messages.format( "persist.nested", except ) );
        }
    }
View Full Code Here

TOP

Related Classes of org.exolab.castor.jdo.PersistenceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.