Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2013 Red Hat, Inc. and/or its affiliates.
   *
   * Licensed under the Eclipse Public License version 1.0, available at
   * http://www.eclipse.org/legal/epl-v10.html
   */
  
  package org.jboss.forge.addon.javaee.jpa;
  
 
 import  javax.persistence.GenerationType;
 
 import  org.jboss.forge.addon.parser.java.resources.JavaResource;
 import  org.jboss.forge.addon.projects.Project;
 import  org.jboss.forge.addon.resource.DirectoryResource;
 import  org.jboss.forge.addon.resource.FileResource;
 import  org.jboss.forge.roaster.model.JavaClass;
Defines JPA specific operations

Author(s):
Lincoln Baxter, III
 
 public interface PersistenceOperations
 {
    public static final String DEFAULT_UNIT_SUFFIX = "-persistence-unit";
    public static final String DEFAULT_UNIT_DESC = "Forge Persistence Unit";

   
Setups JPA in the project for the given attributes. If persistence unit with the name already exists, the unit will be overwritten.

Parameters:
unitName Name of the created Persistence Unit
project Project for which the JPA is being set up
dataSource JPA data-source configuration
configureMetadata configure the metadata
 
    public FileResource<?> setup(String unitName, Project projectJPADataSource dataSourceboolean configureMetadata);
   
   
Get the object representing the persistence unit, null is returned when no persistence unit was found.

Parameters:
unitName Name of the Persistence Unit
project Project in which the JPA is being looked for
 
    @SuppressWarnings({ "rawtypes""unchecked" })
    public PersistenceUnitCommon getExistingPersistenceUnit(Project projectString unitName);

   
Creates a new JavaResource in the specified project. If no project is available, use PersistenceOperations.newEntity(DirectoryResource, String, String, GenerationType)

Parameters:
project the current project to create the entity. Must not be null
entityName the name of the entity
entityPackage the package of the entity to be created
idStrategy the ID strategy chosen for this entity
Returns:
the created java resource
Throws:
FileNotFoundException if something wrong happens while saving the JavaClass
 
    public JavaResource newEntity(Project projectString entityNameString entityPackage, GenerationType idStrategy,
             String tableNamethrows FileNotFoundException;

   
Creates a new JavaResource in the specified target. If a project is available, use PersistenceOperations.newEntity(Project, String, String, GenerationType)

Parameters:
target the target directory resource to create this class
entityName the name of the entity
entityPackage the package of the entity to be created
idStrategy the ID strategy chosen for this entity
tableName the table name (optional)
Returns:
the created java resource
Throws:
FileNotFoundException if something wrong happens while saving the JavaClass
 
    public JavaResource newEntity(DirectoryResource targetString entityNameString entityPackage,
             GenerationType idStrategyString tableName);

   
Creates a new JavaResource in the specified project. If no project is available, use PersistenceOperations.newEntity(DirectoryResource, String, String, GenerationType)

Parameters:
project the current project to create the entity. Must not be null
entityName the name of the entity
entityPackage the package of the entity to be created
idStrategy the ID strategy chosen for this entity
Returns:
the created java resource
Throws:
FileNotFoundException if something wrong happens while saving the JavaClass
 
    public JavaResource newEntity(Project projectString entityNameString entityPackage, GenerationType idStrategy)
             throws FileNotFoundException;

   
Creates a new JavaResource in the specified target. If a project is available, use PersistenceOperations.newEntity(Project, String, String, GenerationType)

Parameters:
target the target directory resource to create this class
entityName the name of the entity
entityPackage the package of the entity to be created
idStrategy the ID strategy chosen for this entity
Returns:
the created java resource
Throws:
FileNotFoundException if something wrong happens while saving the JavaClass
   public JavaResource newEntity(DirectoryResource targetString entityNameString entityPackage,
            GenerationType idStrategy);

   
   
Creates a new JavaResource for an embeddable entity in the specified project. If a project is available, use PersistenceOperations.newEmbeddableEntity(Project, String, String)

Parameters:
target the target directory resource to create this class
entityName the name of the entity
entityPackage the package of the entity to be created
Returns:
the created java resource
Throws:
FileNotFoundException if something wrong happens while saving the JavaClass
   public JavaResource newEmbeddableEntity(DirectoryResource targetString entityNameString entityPackage);
   
   
   
Creates a new JavaResource for an embeddable entity in the specified target. If no project is available, use PersistenceOperations.newEmbeddableEntity(DirectoryResource, String, String)

Parameters:
project the current project to create the entity. Must not be null
entityName the name of the entity
entityPackage the package of the entity to be created
Returns:
the created java resource
Throws:
FileNotFoundException if something wrong happens while saving the JavaClass
   public JavaResource newEmbeddableEntity(Project projectString entityNameString entityPackagethrows FileNotFoundException;
New to GrepCode? Check out our FAQ X