Package org.apache.ojb.broker.metadata

Examples of org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException


            {
                // 1. create an empty Object (persistent classes need a public default constructor)
                Constructor con = cld.getZeroArgumentConstructor();
                if(con == null)
                {
                    throw new ClassNotPersistenceCapableException(
                    "A zero argument constructor was not provided! Class was '" + cld.getClassNameOfObject() + "'");
                }
                result = ConstructorHelper.instantiate(con);
            }
            catch (InstantiationException e)
            {
                throw new ClassNotPersistenceCapableException(
                        "Can't instantiate class '" + cld.getClassNameOfObject()+"'");
            }
        }
        else
        {
View Full Code Here


            {
                result = ClassHelper.newInstance(clazz, true);
            }
            catch(Exception e1)
            {
                throw new ClassNotPersistenceCapableException("Can't instantiate class '"
                        + (clazz != null ? clazz.getName() : "null")
                        + "', message was: " + e1.getMessage() + ")", e1);
            }
        }
        return result;
View Full Code Here

     */
    public static Object instantiate(Constructor constructor) throws InstantiationException
    {
        if(constructor == null)
        {
            throw new ClassNotPersistenceCapableException(
                    "A zero argument constructor was not provided!");
        }

        Object result = null;
        try
        {
            result = constructor.newInstance(NO_ARGS);
        }
        catch(InstantiationException e)
        {
            throw e;
        }
        catch(Exception e)
        {
            throw new ClassNotPersistenceCapableException("Can't instantiate class '"
                    + (constructor != null ? constructor.getDeclaringClass().getName() : "null")
                    + "' with given constructor: " + e.getMessage(), e);
        }
        return result;
    }
View Full Code Here

        {
            msg = "Unexpected error:";
        }
        if(e != null)
        {
            return new ClassNotPersistenceCapableException(msg + eol +
                        "objectTopLevelClass=" + (m_objectsTopLevelClass != null ? m_objectsTopLevelClass.getName() : null) + eol +
                        "objectRealClass=" + (m_objectsRealClass != null ? m_objectsRealClass.getName() : null) + eol +
                        "pkValues=" + (m_pkValues != null ? ArrayUtils.toString(m_pkValues) : null) +
                        (objectToIdentify != null ? (eol + "object to identify: " + objectToIdentify) : ""), e);
        }
        else
        {
            return new ClassNotPersistenceCapableException(msg + eol +
                        "objectTopLevelClass=" + (m_objectsTopLevelClass != null ? m_objectsTopLevelClass.getName() : null) + eol +
                        "objectRealClass=" + (m_objectsRealClass != null ? m_objectsRealClass.getName() : null) + eol +
                        "pkValues=" + (m_pkValues != null ? ArrayUtils.toString(m_pkValues) : null) +
                        eol + "object to identify: " + objectToIdentify);
        }
View Full Code Here

            checkForPrimaryKeys();
        }
        catch (Exception e)
        {
            throw new ClassNotPersistenceCapableException("Can not init Identity for given object " +
                    objectToIdentify, e);
        }
    }
View Full Code Here

    protected void checkForPrimaryKeys() throws ClassNotPersistenceCapableException
    {
        // if no PKs are specified OJB can't handle this class !
        if (m_pkValues.length == 0)
        {
            throw new ClassNotPersistenceCapableException(
                    "OJB needs at least one primary key attribute for class "
                    + " objectsRealClass=" + m_objectsRealClass
                    + ", objectTopLevelClass=" + m_objectsTopLevelClass);

        }
View Full Code Here

        {
            msg = "Unexpected error:";
        }
        if(e != null)
        {
            return new ClassNotPersistenceCapableException(msg + eol +
                        "objectTopLevelClass=" + (m_objectsTopLevelClass != null ? m_objectsTopLevelClass.getName() : null) + eol +
                        "objectRealClass=" + (m_objectsRealClass != null ? m_objectsRealClass.getName() : null) + eol +
                        "pkValues=" + (m_pkValues != null ? ArrayUtils.toString(m_pkValues) : null) +
                        (objectToIdentify != null ? (eol + "object to identify: " + objectToIdentify) : ""), e);
        }
        else
        {
            return new ClassNotPersistenceCapableException(msg + eol +
                        "objectTopLevelClass=" + (m_objectsTopLevelClass != null ? m_objectsTopLevelClass.getName() : null) + eol +
                        "objectRealClass=" + (m_objectsRealClass != null ? m_objectsRealClass.getName() : null) + eol +
                        "pkValues=" + (m_pkValues != null ? ArrayUtils.toString(m_pkValues) : null) +
                        eol + "object to identify: " + objectToIdentify);
        }
View Full Code Here

            {
                // 1. create an empty Object (persistent classes need a public default constructor)
                Constructor con = cld.getZeroArgumentConstructor();
                if(con == null)
                {
                    throw new ClassNotPersistenceCapableException(
                    "A zero argument constructor was not provided! Class was '" + cld.getClassNameOfObject() + "'");
                }
                result = ConstructorHelper.instantiate(con);
            }
            catch (InstantiationException e)
            {
                throw new ClassNotPersistenceCapableException(
                        "Can't instantiate class '" + cld.getClassNameOfObject()+"'");
            }
        }
        else
        {
View Full Code Here

            {
                result = ClassHelper.newInstance(clazz, true);
            }
            catch(Exception e1)
            {
                throw new ClassNotPersistenceCapableException("Can't instantiate class '"
                        + (clazz != null ? clazz.getName() : "null")
                        + "', message was: " + e1.getMessage() + ")", e1);
            }
        }
        return result;
View Full Code Here

     */
    public static Object instantiate(Constructor constructor) throws InstantiationException
    {
        if(constructor == null)
        {
            throw new ClassNotPersistenceCapableException(
                    "A zero argument constructor was not provided!");
        }

        Object result = null;
        try
        {
            result = constructor.newInstance(NO_ARGS);
        }
        catch(InstantiationException e)
        {
            throw e;
        }
        catch(Exception e)
        {
            throw new ClassNotPersistenceCapableException("Can't instantiate class '"
                    + (constructor != null ? constructor.getDeclaringClass().getName() : "null")
                    + "' with given constructor: " + e.getMessage(), e);
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException

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.