Package org.datanucleus.exceptions

Examples of org.datanucleus.exceptions.NucleusException


            dateExpr.toSQLText().append(getFunctionName());
            return dateExpr;
        }
        else
        {
            throw new NucleusException(LOCALISER.msg("060002", getFunctionName(), expr));
        }
    }
View Full Code Here


     */
    public SQLExpression getExpression(SQLExpression expr, List args)
    {
        if (!(expr instanceof TemporalExpression))
        {
            throw new NucleusException(LOCALISER.msg("060001", "getHour()", expr));
        }

        ArrayList funcArgs = new ArrayList();
        funcArgs.add(expr);
        return new NumericExpression(stmt, getMappingForClass(int.class), "HOUR", funcArgs);
View Full Code Here

     */
    public SQLExpression getExpression(SQLExpression expr, List args)
    {
        if (args == null || args.size() == 0 || args.size() > 2)
        {
            throw new NucleusException(LOCALISER.msg("060003", "indexOf", "StringExpression", 0,
                "StringExpression/CharacterExpression/ParameterLiteral"));
        }
        else
        {
            // {stringExpr}.indexOf(strExpr1 [,numExpr2])
            SQLExpression substrExpr = (SQLExpression)args.get(0);
            if (!(substrExpr instanceof StringExpression) &&
                !(substrExpr instanceof CharacterExpression) &&
                !(substrExpr instanceof ParameterLiteral))
            {
                throw new NucleusException(LOCALISER.msg("060003", "indexOf", "StringExpression", 0,
                    "StringExpression/CharacterExpression/ParameterLiteral"));
            }

            ArrayList funcArgs = new ArrayList();
            if (args.size() == 1)
            {
                // strExpr.indexOf(str1)
                funcArgs.add(expr);
                funcArgs.add(substrExpr);
                SQLExpression oneExpr = ExpressionUtils.getLiteralForOne(stmt);
                NumericExpression locateExpr = new NumericExpression(stmt, getMappingForClass(int.class), "STRPOS", funcArgs);
                return new NumericExpression(locateExpr, Expression.OP_SUB, oneExpr);
            }
            else
            {
                // strExpr.indexOf(str1, pos)
                SQLExpression fromExpr = (SQLExpression)args.get(1);
                if (!(fromExpr instanceof NumericExpression))
                {
                    throw new NucleusException(LOCALISER.msg("060003", "indexOf", "StringExpression", 1,
                        "NumericExpression"));
                }

                // Find the substring starting at this position
                ArrayList substrArgs = new ArrayList(1);
View Full Code Here

            }
            return new NumericExpression(stmt, getMappingForClass(cls), "NULLIF", args);
        }
        else
        {
            throw new NucleusException(LOCALISER.msg("060002", "NULLIF", expr));
        }
    }
View Full Code Here

        {
            this.value = (Boolean)value;
        }
        else
        {
            throw new NucleusException("Cannot create " + this.getClass().getName() +
                " for value of type " + (value != null ? value.getClass().getName() : null));
        }

        if (parameterName != null)
        {
View Full Code Here

     */
    public SQLExpression getExpression(SQLExpression expr, List args)
    {
        if (!(expr instanceof TemporalExpression))
        {
            throw new NucleusException(LOCALISER.msg("060001", "getMonth()", expr));
        }

        ArrayList funcArgs = new ArrayList();
        funcArgs.add(expr);
        NumericExpression monthExpr = new NumericExpression(stmt, getMappingForClass(int.class), "MONTH", funcArgs);
View Full Code Here

        {
            this.value = (String)value;
        }
        else
        {
            throw new NucleusException("Cannot create " + this.getClass().getName() +
                " for value of type " + (value != null ? value.getClass().getName() : null));
        }

        if (parameterName != null)
        {
View Full Code Here

        }

        if (candidateClassNames.isEmpty())
        {
            // Either passed invalid classes, or no concrete classes with available tables present!
            throw new NucleusException("Attempt to generate SQL statement using UNIONs for " +
                candidateType.getName() +
                " yet there are no concrete classes with their own table available");
        }

        SQLStatement stmt = null;
View Full Code Here

        {
            this.value = BigInteger.valueOf(((Byte)value).longValue());
        }
        else
        {
            throw new NucleusException("Cannot create " + this.getClass().getName() +
                " for value of type " + (value != null ? value.getClass().getName() : null));
        }

        if (parameterName != null)
        {
View Full Code Here

            this.value = ((Calendar)value).getTime();
        }
        else
        {
            // Allow for using an input parameter literal
            throw new NucleusException("Cannot create " + this.getClass().getName() +
                " for value of type " + (value != null ? value.getClass().getName() : null));
        }

        if (parameterName != null)
        {
View Full Code Here

TOP

Related Classes of org.datanucleus.exceptions.NucleusException

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.