Package org.datanucleus.exceptions

Examples of org.datanucleus.exceptions.NucleusDataStoreException


                }
            }
        }
        catch (SQLException e)
        {
            throw new NucleusDataStoreException(LOCALISER_RDBMS.msg("055002", "long", "" + param, column, e.getMessage()), e);
        }

        return value;
    }
View Full Code Here


                }
            }
        }
        catch (SQLException e)
        {
            throw new NucleusDataStoreException(LOCALISER_RDBMS.msg("055001", "Long", "" + value, column, e.getMessage()), e);
        }
    }
View Full Code Here

            }
        }
        catch (SQLException e)
        {
            String msg = LOCALISER_RDBMS.msg("055002", "Long", "" + param, column, e.getMessage());
            throw new NucleusDataStoreException(msg, e);
        }

        return value;
    }
View Full Code Here

            }
        }
        catch (SQLException sqe)
        {
            NucleusLogger.DATASTORE.error("Exception thrown on querying of discriminator for id", sqe);
            throw new NucleusDataStoreException(sqe.toString(), sqe);
        }

        return null;
    }
View Full Code Here

            }
        }
        catch (SQLException sqe)
        {
            NucleusLogger.DATASTORE.error(sqe);
            throw new NucleusDataStoreException(sqe.toString());
        }

        return null;
    }
View Full Code Here

                ((PreparedStatement) ps).setTime(param, (Time)value);
            }
        }
        catch (SQLException e)
        {
            throw new NucleusDataStoreException(LOCALISER_RDBMS.msg("055001","java.sql.Time","" + value, column, e.getMessage()), e);
        }
    }
View Full Code Here

        {
            value = ((ResultSet) rs).getTime(param);
        }
        catch (SQLException e)
        {
            throw new NucleusDataStoreException(LOCALISER_RDBMS.msg("055002","java.sql.Time","" + param, column, e.getMessage()), e);
        }

        return value;
    }
View Full Code Here

                        charsRead = reader.read(cbuf);
                    }
                }
                catch (IOException e)
                {
                    throw new NucleusDataStoreException("Error reading Oracle CLOB object: param = " + param, e);
                }
                finally
                {
                    try
                    {
                        reader.close();
                    }
                    catch (IOException e)
                    {
                        throw new NucleusDataStoreException("Error reading Oracle CLOB object: param = " + param, e);
                    }
                }

                value = sbuf.toString();

                if (value.length() == 0)
                {
                    value = null;
                }
                else if (value.equals(getDatabaseAdapter().getSurrogateForEmptyStrings()))
                {
                    value = "";
                }
            }
        }
        catch (SQLException e)
        {
            throw new NucleusDataStoreException(LOCALISER.msg("055001","String", "" + param), e);
        }

        return value;
    }
View Full Code Here

                mconn.release();
            }
        }
        catch (SQLException e)
        {
            throw new NucleusDataStoreException("Update of CLOB value failed: " + textStmt, e);
        }
    }
View Full Code Here

                    ((PreparedStatement)ps).setNull(param, getTypeInfo().getDataType());
                }
            }
            catch (SQLException sqle)
            {
        throw new NucleusDataStoreException(LOCALISER_RDBMS.msg("055001","Object", "" + param, column, sqle.getMessage()),sqle);
            }
        }
        else
        {
            try
            {
                // Use Java serialisation, else byte-streaming, and if not determined then Java serialisation
                if (getJavaTypeMapping().isSerialised())
                {
                    // Serialised field so just perform basic Java serialisation for retrieval
                    if (!(value instanceof Serializable))
                    {
                        throw new NucleusDataStoreException(LOCALISER_RDBMS.msg("055005", value.getClass().getName()));
                    }
                    BlobImpl b = new BlobImpl(value);
                    ((PreparedStatement) ps).setBytes(param, b.getBytes(0, (int) b.length()));
                }
                else if (value instanceof boolean[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromBooleanArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof char[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromCharArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof double[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromDoubleArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof float[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromFloatArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof int[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromIntArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof long[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromLongArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof short[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromShortArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof Boolean[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromBooleanObjectArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof Byte[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromByteObjectArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof Character[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromCharObjectArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof Double[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromDoubleObjectArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof Float[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromFloatObjectArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof Integer[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromIntObjectArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof Long[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromLongObjectArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof Short[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromShortObjectArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof BigDecimal[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromBigDecimalArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof BigInteger[])
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromBigIntegerArray(value);
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof byte[])
                {
                    ((PreparedStatement) ps).setBytes(param, (byte[]) value);
                }
                else if (value instanceof java.util.BitSet)
                {
                    byte[] data = TypeConversionHelper.getByteArrayFromBooleanArray(TypeConversionHelper.getBooleanArrayFromBitSet((java.util.BitSet) value));
                    ((PreparedStatement) ps).setBytes(param, data);
                }
                else if (value instanceof java.awt.image.BufferedImage)
                {
                    ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
                    ImageIO.write((BufferedImage) value, "jpg", baos);
                    byte[] buffer = baos.toByteArray();
                    baos.close();
                    ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
                    ((PreparedStatement) ps).setBytes(param, buffer);
                    bais.close();
                }
                else
                {
                    // Fall back to just perform Java serialisation for storage
                    if (!(value instanceof Serializable))
                    {
                        throw new NucleusDataStoreException(LOCALISER_RDBMS.msg("055005", value.getClass().getName()));
                    }
                    BlobImpl b = new BlobImpl(value);
                    ((PreparedStatement) ps).setBytes(param, b.getBytes(0, (int) b.length()));
                }
            }
            catch (Exception e)
            {
                throw new NucleusDataStoreException(LOCALISER_RDBMS.msg("055001","Object","" + value, column, e.getMessage()),e);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.datanucleus.exceptions.NucleusDataStoreException

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.