Package org.hibernate

Examples of org.hibernate.InstantiationException


    constructor = ReflectHelper.getDefaultConstructor(mappedClass);
  }

  public Object instantiate() {
    if ( ReflectHelper.isAbstractClass(mappedClass) ) {
      throw new InstantiationException( "Cannot instantiate abstract class or interface: ", mappedClass );
    }
    else if ( optimizer != null ) {
      return optimizer.newInstance();
    }
    else if ( constructor == null ) {
      throw new InstantiationException( "No default constructor for entity: ", mappedClass );
    }
    else {
      try {
        return constructor.newInstance( null );
      }
      catch ( Exception e ) {
        throw new InstantiationException( "Could not instantiate entity: ", mappedClass, e );
      }
    }
  }
View Full Code Here


  public Object newInstance() {
    try {
      return fastClass.newInstance();
    }
    catch ( Throwable t ) {
      throw new InstantiationException(
          "Could not instantiate entity with CGLIB optimizer: ",
              fastClass.getJavaClass(),
              t
      );
    }
View Full Code Here

    constructor = ReflectHelper.getDefaultConstructor(mappedClass);
  }

  public Object instantiate() {
    if ( ReflectHelper.isAbstractClass(mappedClass) ) {
      throw new InstantiationException( "Cannot instantiate abstract class or interface: ", mappedClass );
    }
    else if ( optimizer != null ) {
      return optimizer.newInstance();
    }
    else if ( constructor == null ) {
      throw new InstantiationException( "No default constructor for entity: ", mappedClass );
    }
    else {
      try {
        return constructor.newInstance( null );
      }
      catch ( Exception e ) {
        throw new InstantiationException( "Could not instantiate entity: ", mappedClass, e );
      }
    }
  }
View Full Code Here

    constructor = ReflectHelper.getDefaultConstructor( mappedClass );
  }

  public Object instantiate() {
    if ( isAbstract ) {
      throw new InstantiationException( "Cannot instantiate abstract class or interface: ", mappedClass );
    }
    else if ( optimizer != null ) {
      return optimizer.newInstance();
    }
    else if ( constructor == null ) {
      throw new InstantiationException( "No default constructor for entity: ", mappedClass );
    }
    else {
      try {
        return constructor.newInstance( (Object[]) null );
      }
      catch ( Exception e ) {
        throw new InstantiationException( "Could not instantiate entity: ", mappedClass, e );
      }
    }
  }
View Full Code Here

  private static Object instantiate(Constructor constructor) {
    try {
      return constructor.newInstance();
    }
    catch (Exception e) {
      throw new InstantiationException( "could not instantiate test object", constructor.getDeclaringClass(), e );
    }
  }
View Full Code Here

  public Object newInstance() {
    try {
      return fastClass.newInstance();
    }
    catch ( Exception e ) {
      throw new InstantiationException(
          "Could not instantiate entity with Javassist optimizer: ",
          fastClass.getJavaClass(),
          e
      );
    }
View Full Code Here

    constructor = ReflectHelper.getDefaultConstructor(mappedClass);
  }

  public Object instantiate() {
    if ( ReflectHelper.isAbstractClass(mappedClass) ) {
      throw new InstantiationException( "Cannot instantiate abstract class or interface: ", mappedClass );
    }
    else if ( optimizer != null ) {
      return optimizer.newInstance();
    }
    else if ( constructor == null ) {
      throw new InstantiationException( "No default constructor for entity: ", mappedClass );
    }
    else {
      try {
        return constructor.newInstance( null );
      }
      catch ( Exception e ) {
        throw new InstantiationException( "Could not instantiate entity: ", mappedClass, e );
      }
    }
  }
View Full Code Here

  public Object newInstance() {
    try {
      return fastClass.newInstance();
    }
    catch ( Throwable t ) {
      throw new InstantiationException(
          "Could not instantiate entity with CGLIB optimizer: ",
              fastClass.getJavaClass(),
              t
      );
    }
View Full Code Here

  private static Object instantiate(Constructor constructor) {
    try {
      return constructor.newInstance(null);
    }
    catch (Exception e) {
      throw new InstantiationException( "could not instantiate test object", constructor.getDeclaringClass(), e );
    }
  }
View Full Code Here

    constructor = ReflectHelper.getDefaultConstructor(mappedClass);
  }

  public Object instantiate() {
    if ( ReflectHelper.isAbstractClass(mappedClass) ) {
      throw new InstantiationException( "Cannot instantiate abstract class or interface: ", mappedClass );
    }
    else if ( optimizer != null ) {
      return optimizer.newInstance();
    }
    else if ( constructor == null ) {
      throw new InstantiationException( "No default constructor for entity: ", mappedClass );
    }
    else {
      try {
        return constructor.newInstance( null );
      }
      catch ( Exception e ) {
        throw new InstantiationException( "Could not instantiate entity: ", mappedClass, e );
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.hibernate.InstantiationException

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.