Package javax.ejb

Examples of javax.ejb.DuplicateKeyException


            // insert-after-ejb-post-create
            try {
                pctx.flush();
            } catch (SQLException e) {
                if ("23000".equals(e.getSQLState())) {
                    throw new DuplicateKeyException("Unique key violation or invalid foreign key value: pk=" + ctx.getPrimaryKey());
                } else {
                    throw new CreateException("Failed to create instance: pk=" +
                            ctx.getPrimaryKey() +
                            ", state=" +
                            e.getSQLState() +
View Full Code Here


            // insert-after-ejb-post-create
            try {
                pctx.flush();
            } catch (SQLException e) {
                if ("23000".equals(e.getSQLState())) {
                    throw new DuplicateKeyException("Unique key violation or invalid foreign key value: pk=" + ctx.getPrimaryKey());
                } else {
                    throw new CreateException("Failed to create instance: pk=" + ctx.getPrimaryKey() +
                            ", state=" + e.getSQLState() +
                            ", msg=" + e.getMessage());
                }
View Full Code Here

            // insert-after-ejb-post-create
            try {
                pctx.flush();
            } catch (SQLException e) {
                if ("23000".equals(e.getSQLState())) {
                    throw new DuplicateKeyException("Unique key violation or invalid foreign key value: pk=" + ctx.getPrimaryKey());
                } else {
                    throw new CreateException("Failed to create instance: pk=" +
                            ctx.getPrimaryKey() +
                            ", state=" +
                            e.getSQLState() +
View Full Code Here

            {
               throw new CreateException("Error checking if entity with primary pk " + pk + "exists: SQL returned no rows");
            }
            if(rs.getInt(1) > 0)
            {
               throw new DuplicateKeyException("Entity with primary key " + pk + " already exists");
            }
         }
         catch(SQLException e)
         {
            log.error("Error checking if entity exists", e);
View Full Code Here

      try {
         Object id = idField.get(ctx.getInstance());
        
         // Check exist
         if (getFile(id).exists())
            throw new DuplicateKeyException("Already exists: "+id);
        
         // Store to file
         storeEntity(id, ctx.getInstance());
        
         return id;
View Full Code Here

         }
         catch(SQLException e)
         {
            if("23000".equals(e.getSQLState()))
            {
               throw new DuplicateKeyException("Unique key violation or invalid foreign key value: pk=" + ctx.getId());
            }
            else
            {
               throw new CreateException("Failed to create instance: pk=" +
                  ctx.getId() +
View Full Code Here

         }
         catch(SQLException e)
         {
            if("23000".equals(e.getSQLState()))
            {
               throw new DuplicateKeyException("Unique key violation or invalid foreign key value: pk=" + ctx.getId());
            }
            else
            {
               throw new CreateException("Failed to create instance: pk=" +
                  ctx.getId() +
View Full Code Here

         }
         catch(SQLException e)
         {
            if("23000".equals(e.getSQLState()))
            {
               throw new DuplicateKeyException("Unique key violation or invalid foreign key value: pk=" + ctx.getId());
            }
            else
            {
               throw new CreateException("Failed to create instance: pk=" + ctx.getId() +
                  ", state=" + e.getSQLState() +
View Full Code Here

/*    */         {
/* 95 */           throw new CreateException("Error checking if entity with primary pk " + pk + "exists: SQL returned no rows");
/*    */         }
/* 97 */         if (rs.getInt(1) > 0)
/*    */         {
/* 99 */           throw new DuplicateKeyException("Entity with primary key " + pk + " already exists");
/*    */         }
/*    */       }
/*    */       catch (SQLException e)
/*    */       {
/* 104 */         this.log.error("Error checking if entity exists", e);
View Full Code Here

/*     */       }
/*     */       catch (SQLException e)
/*     */       {
/* 136 */         if ("23000".equals(e.getSQLState()))
/*     */         {
/* 138 */           throw new DuplicateKeyException("Unique key violation or invalid foreign key value: pk=" + ctx.getId());
/*     */         }
/*     */
/* 142 */         throw new CreateException("Failed to create instance: pk=" + ctx.getId() + ", state=" + e.getSQLState() + ", msg=" + e.getMessage());
/*     */       }
/*     */
View Full Code Here

TOP

Related Classes of javax.ejb.DuplicateKeyException

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.