|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.sahits.codegen.model.BasicModelGenerator
ch.sahits.codegen.generator.HibernateConfigurationCreator
public final class HibernateConfigurationCreator
This class generates a Hibernate XML configuration file.
The input is based upon the a BasicDataBaseTable and
a database definition. The output is a file that is something like
this
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:postgresql://localhost/firsthibernate</property>
<property name="connection.username">postgres</property>
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="connection.password">p</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<!-- thread is the short name for
org.hibernate.context.ThreadLocalSessionContext
and let Hibernate bind the session automatically to the thread
-->
<property name="current_session_context_class">thread</property>
<!-- this will show us all sql statements -->
<property name="hibernate.show_sql">true</property>
<!-- mapping files -->
<mapping resource="de/laliluna/example/Honey.hbm.xml" />
</session-factory>
</hibernate-configuration>
| Constructor Summary | |
|---|---|
HibernateConfigurationCreator()
|
|
| Method Summary | |
|---|---|
IGeneratedObject |
createModel(IProgressMonitor monitor,
IOutputFileModel model)
Create an arbitrary model for the generator class. |
IFile |
generate()
Generate a Hibernate XML configuration file and return it as a String |
java.lang.String |
getAbsoluteOutputLoacation()
Retrieve the absolute path to the file output location based on the initialized model |
void |
init(IOutputFileModel outputModel,
IGeneratedObject model)
Initialize the model this generators model The model must be an instance of IDBTable. |
boolean |
isGeneratedOutputFile()
This generator class generate() method returns an IFile instance |
| Methods inherited from class ch.sahits.codegen.model.BasicModelGenerator |
|---|
createModelWithDBInputFile, createModelWithoutDB, initModel |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HibernateConfigurationCreator()
| Method Detail |
|---|
public void init(IOutputFileModel outputModel,
IGeneratedObject model)
IDBTable.
If the model is not of this type a ClassCastException is thrown
init in interface IGeneralGeneratoroutputModel - IOutputFileModel that defines the setup of the generationmodel - IDBTablepublic IFile generate()
generate in interface IGeneralFileGeneratorpublic boolean isGeneratedOutputFile()
generate() method returns an IFile instance
isGeneratedOutputFile in interface IGeneralGenerator
public IGeneratedObject createModel(IProgressMonitor monitor,
IOutputFileModel model)
IDBTable from the object model.
createModel in interface IGeneralGeneratormonitor - to monitor the progressmodel - Model of the data of the wizard
init(IOutputFileModel, IGeneratedObject)public java.lang.String getAbsoluteOutputLoacation()
getAbsoluteOutputLoacation in interface IGeneralFileGenerator
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||