public class SessionFactoryBuilder extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SessionFactoryBuilder.DynamicClassLoaderService |
| Modifier and Type | Field and Description |
|---|---|
protected javassist.ClassPool |
classPool |
protected Configuration |
configuration |
protected com.manydesigns.portofino.model.database.Database |
database |
protected EntityMode |
entityMode |
protected String |
falseString |
protected static Set<String> |
JAVA_KEYWORDS |
protected MultiTenancyImplementation |
multiTenancyImplementation |
protected String |
trueString |
| Constructor and Description |
|---|
SessionFactoryBuilder(com.manydesigns.portofino.model.database.Database database,
Configuration configuration,
MultiTenancyImplementation multiTenancyImplementation) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addGeneratedValueAnnotation(GenerationType generationType,
String generatorName,
javassist.bytecode.AnnotationsAttribute fieldAnnotations,
javassist.bytecode.ConstPool constPool) |
SessionFactoryAndCodeBase |
buildSessionFactory() |
SessionFactoryAndCodeBase |
buildSessionFactory(com.manydesigns.portofino.code.CodeBase codeBase,
List<com.manydesigns.portofino.model.database.Table> tablesToMap,
List<com.manydesigns.portofino.model.database.Table> externallyMappedTables) |
SessionFactoryAndCodeBase |
buildSessionFactory(org.apache.commons.vfs2.FileObject root) |
protected boolean |
checkInvalidPrimaryKey(com.manydesigns.portofino.model.database.Table table) |
protected boolean |
checkInvalidPrimaryKey(com.manydesigns.portofino.model.database.Table table,
boolean warn) |
protected boolean |
checkValidFk(com.manydesigns.portofino.model.database.ForeignKey foreignKey) |
protected void |
configureAnnotations(com.manydesigns.portofino.model.database.Table table,
javassist.bytecode.ConstPool constPool,
javassist.bytecode.AnnotationsAttribute classAnnotations) |
protected javassist.bytecode.annotation.Annotation |
convertAnnotation(javassist.bytecode.ConstPool constPool,
com.manydesigns.portofino.model.Annotation portofinoAnnotation) |
protected void |
defineEqualsAndHashCode(com.manydesigns.portofino.model.database.Table table,
javassist.CtClass cc) |
static String |
deriveMappedClassName(com.manydesigns.portofino.model.database.Table table,
EntityMode entityMode) |
protected boolean |
ensurePrimaryKey(com.manydesigns.portofino.model.database.Table table) |
static String |
ensureValidJavaName(String fullName) |
protected String |
entityNameToFileName(com.manydesigns.portofino.model.database.Table table) |
protected void |
finalizeRelationshipProperty(javassist.CtClass cc,
javassist.CtField field,
javassist.bytecode.annotation.Annotation annotation,
javassist.bytecode.AnnotationsAttribute fieldAnnotations) |
javassist.CtClass |
generateBaseClass() |
javassist.CtClass |
generateClass(com.manydesigns.portofino.model.database.Table table) |
String |
getBaseEntityName() |
byte[] |
getClassFile(com.manydesigns.portofino.model.database.Table table) |
protected org.apache.commons.vfs2.FileObject |
getEntityLocation(org.apache.commons.vfs2.FileObject root,
com.manydesigns.portofino.model.database.Table table) |
EntityMode |
getEntityMode() |
protected javassist.CtClass |
getMappedClass(com.manydesigns.portofino.model.database.Table table) |
String |
getMappedClassName(com.manydesigns.portofino.model.database.Table table) |
static String |
getMappedClassName(com.manydesigns.portofino.model.database.Table table,
EntityMode entityMode) |
Class<?> |
getPersistentClass(com.manydesigns.portofino.model.database.Table table,
com.manydesigns.portofino.code.CodeBase codeBase) |
String |
jpaEscape(String columnName)
https://vladmihalcea.com/escape-sql-reserved-keywords-jpa-hibernate/
|
protected javassist.bytecode.annotation.Annotation |
makeGeneratedValueAnnotation(GenerationType identity,
javassist.bytecode.ConstPool constPool) |
protected javassist.bytecode.annotation.Annotation |
makeParameterAnnotation(String name,
String value,
javassist.bytecode.ConstPool constPool) |
protected void |
mapManyToOne(com.manydesigns.portofino.model.database.ForeignKey foreignKey) |
protected void |
mapOneToMany(com.manydesigns.portofino.model.database.ForeignKey foreignKey) |
void |
mapRelationships(com.manydesigns.portofino.model.database.Table table) |
protected void |
setupColumns(com.manydesigns.portofino.model.database.Table table,
javassist.CtClass cc,
javassist.bytecode.ConstPool constPool) |
protected void |
setupColumnType(com.manydesigns.portofino.model.database.Column column,
javassist.bytecode.AnnotationsAttribute fieldAnnotations,
javassist.bytecode.ConstPool constPool) |
protected Map<String,Object> |
setupConnection() |
protected void |
setupIdentityGenerator(javassist.bytecode.AnnotationsAttribute fieldAnnotations,
javassist.bytecode.ConstPool constPool) |
protected void |
setupMultiTenantConnection(com.manydesigns.portofino.model.database.ConnectionProvider connectionProvider,
Map<String,Object> settings) |
protected void |
setupNonIdentityGenerator(com.manydesigns.portofino.model.database.Table table,
javassist.bytecode.AnnotationsAttribute fieldAnnotations,
com.manydesigns.portofino.model.database.Generator generator,
javassist.bytecode.ConstPool constPool) |
protected void |
setupSingleTenantConnection(com.manydesigns.portofino.model.database.ConnectionProvider connectionProvider,
Map<String,Object> settings) |
protected static String |
toJavaLikeName(String name) |
protected String trueString
protected String falseString
protected final com.manydesigns.portofino.model.database.Database database
protected final javassist.ClassPool classPool
protected final Configuration configuration
protected final MultiTenancyImplementation multiTenancyImplementation
protected EntityMode entityMode
public SessionFactoryBuilder(com.manydesigns.portofino.model.database.Database database,
Configuration configuration,
MultiTenancyImplementation multiTenancyImplementation)
public SessionFactoryAndCodeBase buildSessionFactory()
public SessionFactoryAndCodeBase buildSessionFactory(org.apache.commons.vfs2.FileObject root) throws Exception
Exceptionprotected boolean checkInvalidPrimaryKey(com.manydesigns.portofino.model.database.Table table)
protected boolean checkInvalidPrimaryKey(com.manydesigns.portofino.model.database.Table table,
boolean warn)
protected boolean ensurePrimaryKey(com.manydesigns.portofino.model.database.Table table)
public SessionFactoryAndCodeBase buildSessionFactory(com.manydesigns.portofino.code.CodeBase codeBase, List<com.manydesigns.portofino.model.database.Table> tablesToMap, List<com.manydesigns.portofino.model.database.Table> externallyMappedTables)
protected void setupMultiTenantConnection(com.manydesigns.portofino.model.database.ConnectionProvider connectionProvider,
Map<String,Object> settings)
protected void setupSingleTenantConnection(com.manydesigns.portofino.model.database.ConnectionProvider connectionProvider,
Map<String,Object> settings)
protected org.apache.commons.vfs2.FileObject getEntityLocation(org.apache.commons.vfs2.FileObject root,
com.manydesigns.portofino.model.database.Table table)
throws org.apache.commons.vfs2.FileSystemException
org.apache.commons.vfs2.FileSystemException@NotNull protected String entityNameToFileName(com.manydesigns.portofino.model.database.Table table)
@NotNull public String getMappedClassName(com.manydesigns.portofino.model.database.Table table)
@NotNull public static String getMappedClassName(com.manydesigns.portofino.model.database.Table table, EntityMode entityMode)
@NotNull public static String deriveMappedClassName(com.manydesigns.portofino.model.database.Table table, EntityMode entityMode)
public Class<?> getPersistentClass(com.manydesigns.portofino.model.database.Table table, com.manydesigns.portofino.code.CodeBase codeBase) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic byte[] getClassFile(com.manydesigns.portofino.model.database.Table table)
throws javassist.NotFoundException,
IOException,
javassist.CannotCompileException
javassist.NotFoundExceptionIOExceptionjavassist.CannotCompileExceptionpublic javassist.CtClass generateBaseClass()
throws javassist.NotFoundException
javassist.NotFoundExceptionprotected javassist.bytecode.annotation.Annotation makeParameterAnnotation(String name, String value, javassist.bytecode.ConstPool constPool)
@NotNull public String getBaseEntityName()
public javassist.CtClass generateClass(com.manydesigns.portofino.model.database.Table table)
throws javassist.CannotCompileException,
javassist.NotFoundException
javassist.CannotCompileExceptionjavassist.NotFoundExceptionprotected void defineEqualsAndHashCode(com.manydesigns.portofino.model.database.Table table,
javassist.CtClass cc)
throws javassist.CannotCompileException
javassist.CannotCompileExceptionprotected void configureAnnotations(com.manydesigns.portofino.model.database.Table table,
javassist.bytecode.ConstPool constPool,
javassist.bytecode.AnnotationsAttribute classAnnotations)
@Nullable
protected javassist.bytecode.annotation.Annotation convertAnnotation(javassist.bytecode.ConstPool constPool,
com.manydesigns.portofino.model.Annotation portofinoAnnotation)
protected void setupColumns(com.manydesigns.portofino.model.database.Table table,
javassist.CtClass cc,
javassist.bytecode.ConstPool constPool)
throws javassist.CannotCompileException,
javassist.NotFoundException
javassist.CannotCompileExceptionjavassist.NotFoundExceptionpublic String jpaEscape(String columnName)
protected void setupIdentityGenerator(javassist.bytecode.AnnotationsAttribute fieldAnnotations,
javassist.bytecode.ConstPool constPool)
protected void setupNonIdentityGenerator(com.manydesigns.portofino.model.database.Table table,
javassist.bytecode.AnnotationsAttribute fieldAnnotations,
com.manydesigns.portofino.model.database.Generator generator,
javassist.bytecode.ConstPool constPool)
protected void addGeneratedValueAnnotation(GenerationType generationType, String generatorName, javassist.bytecode.AnnotationsAttribute fieldAnnotations, javassist.bytecode.ConstPool constPool)
@NotNull protected javassist.bytecode.annotation.Annotation makeGeneratedValueAnnotation(GenerationType identity, javassist.bytecode.ConstPool constPool)
protected void setupColumnType(com.manydesigns.portofino.model.database.Column column,
javassist.bytecode.AnnotationsAttribute fieldAnnotations,
javassist.bytecode.ConstPool constPool)
public void mapRelationships(com.manydesigns.portofino.model.database.Table table)
throws javassist.NotFoundException,
javassist.CannotCompileException
javassist.NotFoundExceptionjavassist.CannotCompileExceptionprotected void mapManyToOne(com.manydesigns.portofino.model.database.ForeignKey foreignKey)
throws javassist.CannotCompileException,
javassist.NotFoundException
javassist.CannotCompileExceptionjavassist.NotFoundExceptionprotected boolean checkValidFk(com.manydesigns.portofino.model.database.ForeignKey foreignKey)
protected void mapOneToMany(com.manydesigns.portofino.model.database.ForeignKey foreignKey)
throws javassist.NotFoundException,
javassist.CannotCompileException
javassist.NotFoundExceptionjavassist.CannotCompileExceptionprotected void finalizeRelationshipProperty(javassist.CtClass cc,
javassist.CtField field,
javassist.bytecode.annotation.Annotation annotation,
javassist.bytecode.AnnotationsAttribute fieldAnnotations)
throws javassist.CannotCompileException
javassist.CannotCompileExceptionprotected javassist.CtClass getMappedClass(com.manydesigns.portofino.model.database.Table table)
throws javassist.NotFoundException
javassist.NotFoundExceptionpublic EntityMode getEntityMode()
Copyright © 2022 MANYDESIGNS s.r.l.. All rights reserved.