private SessionFactory locateSessionFactory() { String jndiName = properties.getProperty(Environment.SESSION_FACTORY_NAME); if (jndiName != null) { return (SessionFactory)SessionFactoryObjectFactory.getNamedInstance(jndiName);
/** * Custom deserialization hook used during Session deserialization. * * @param ois The stream from which to "read" the factory * @throws IOException */ static SessionFactoryImpl deserialize(ObjectInputStream ois) throws IOException, ClassNotFoundException { String uuid = ois.readUTF(); boolean isNamed = ois.readBoolean(); String name = null; if ( isNamed ) { name = ois.readUTF(); } Object result = SessionFactoryObjectFactory.getInstance( uuid ); if ( result == null ) { log.trace( "could not locate session factory by uuid [" + uuid + "] during session deserialization; trying name" ); if ( isNamed ) { result = SessionFactoryObjectFactory.getNamedInstance( name ); } if ( result == null ) { throw new InvalidObjectException( "could not resolve session factory during session deserialization [uuid=" + uuid + ", name=" + name + "]" ); } } return ( SessionFactoryImpl ) result; }
private Object readResolve() throws ObjectStreamException { log.trace("Resolving serialized SessionFactory"); // look for the instance by uuid Object result = SessionFactoryObjectFactory.getInstance(uuid); if (result==null) { // in case we were deserialized in a different JVM, look for an instance with the same name // (alternatively we could do an actual JNDI lookup here....) result = SessionFactoryObjectFactory.getNamedInstance(name); if (result==null) { throw new InvalidObjectException("Could not find a SessionFactory named: " + name); } else { log.debug("resolved SessionFactory by name"); } } else { log.debug("resolved SessionFactory by uid"); } return result; }
private Object readResolve() throws ObjectStreamException { // look for the instance by uuid Object result = SessionFactoryObjectFactory.getInstance(uuid); if (result==null) { // in case we were deserialized in a different JVM, look for an instance with the same name // (alternatively we could do an actual JNDI lookup here....) result = SessionFactoryObjectFactory.getNamedInstance(name); if (result==null) { throw new InvalidObjectException("Could not find a stub SessionFactory named: " + name); } else { log.debug("resolved stub SessionFactory by name"); } } else { log.debug("resolved stub SessionFactory by uid"); } return result; }
private Object readResolve() throws ObjectStreamException { // look for the instance by uuid Object result = SessionFactoryObjectFactory.getInstance(uuid); if (result==null) { // in case we were deserialized in a different JVM, look for an instance with the same name // (alternatively we could do an actual JNDI lookup here....) result = SessionFactoryObjectFactory.getNamedInstance(name); if (result==null) { throw new InvalidObjectException("Could not find a stub SessionFactory named: " + name); } else { log.debug("resolved stub SessionFactory by name"); } } else { log.debug("resolved stub SessionFactory by uid"); } return result; }
private Object readResolve() throws ObjectStreamException { log.trace("Resolving serialized SessionFactory"); // look for the instance by uuid Object result = SessionFactoryObjectFactory.getInstance(uuid); if (result==null) { // in case we were deserialized in a different JVM, look for an instance with the same name // (alternatively we could do an actual JNDI lookup here....) result = SessionFactoryObjectFactory.getNamedInstance(name); if (result==null) { throw new InvalidObjectException("Could not find a SessionFactory named: " + name); } else { log.debug("resolved SessionFactory by name"); } } else { log.debug("resolved SessionFactory by uid"); } return result; }
private SessionFactory locateSessionFactory() { String jndiName = properties.getProperty(Environment.SESSION_FACTORY_NAME); if (jndiName != null) { return (SessionFactory)SessionFactoryObjectFactory.getNamedInstance(jndiName);
private SessionFactory locateSessionFactory() { String jndiName = properties.getProperty(Environment.SESSION_FACTORY_NAME); if (jndiName != null) { return (SessionFactory)SessionFactoryObjectFactory.getNamedInstance(jndiName);
private SessionFactory locateSessionFactory() { String jndiName = properties.getProperty(Environment.SESSION_FACTORY_NAME); if (jndiName != null) { return (SessionFactory)SessionFactoryObjectFactory.getNamedInstance(jndiName);