Package org.hibernate.internal

Examples of org.hibernate.internal.SessionImpl


    final String sql = "select "+seqName+".nextval  from dual";
   
    Connection conn = null;
    PreparedStatement ps = null;
    ResultSet rs = null;
    SessionImpl session = null;
    try{
      session = ((SessionImpl)getEntityManager().getDelegate());
      conn = session.connection();
      ps = conn.prepareStatement(sql);
      rs = ps.executeQuery();
      while(rs.next()){
        return rs.getLong(1);
      }
View Full Code Here


            throw new UnexpectedException("During cascading save()", e);
        }
    }

    private static void cascadeOrphans(JPABase base, PersistentCollection persistentCollection, boolean willBeSaved) {
        SessionImpl session = ((SessionImpl) JPA.em().getDelegate());
        PersistenceContext pc = session.getPersistenceContext();
        CollectionEntry ce = pc.getCollectionEntry(persistentCollection);

        if (ce != null) {
            CollectionPersister cp = ce.getLoadedPersister();
            if (cp != null) {
                Type ct = cp.getElementType();
                if (ct instanceof EntityType) {
                    EntityEntry entry = pc.getEntry(base);
                    String entityName =  entry.getEntityName();
                    entityName = ((EntityType) ct).getAssociatedEntityName(session.getFactory());
                    if (ce.getSnapshot() != null) {
                        Collection orphans = ce.getOrphans(entityName, persistentCollection);
                        for (Object o : orphans) {
                            saveAndCascadeIfJPABase(o, willBeSaved);
                        }
View Full Code Here

TOP

Related Classes of org.hibernate.internal.SessionImpl

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.