*** empty log message ***
This commit is contained in:
parent
6ae8b6a26f
commit
1eee275e7a
8 changed files with 1755 additions and 20 deletions
92
src/java/org/thdl/lex/util/ConvertDataToNewMapping.java
Normal file
92
src/java/org/thdl/lex/util/ConvertDataToNewMapping.java
Normal file
|
@ -0,0 +1,92 @@
|
|||
package org.thdl.lex.util;
|
||||
|
||||
import junit.framework.*;
|
||||
import org.thdl.lex.*;
|
||||
import org.thdl.lex.component.*;
|
||||
import org.apache.commons.dbcp.BasicDataSourceFactory;
|
||||
import java.util.*;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.Name;
|
||||
import net.sf.hibernate.*;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created February 16, 2004
|
||||
*/
|
||||
public class ConvertDataToNewMapping
|
||||
{
|
||||
public static File file = null;
|
||||
|
||||
public static void convertLexComponents()
|
||||
{ try
|
||||
{
|
||||
|
||||
if ( file.exists() )
|
||||
{
|
||||
System.out.println( "Config File exists!" );
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println( "Config File DOES NOT exist!" );
|
||||
}
|
||||
|
||||
HibernateSessionDataTransfer.setConfig( file );
|
||||
HibernateSessionDataTransfer.setConfigResource( args[0] );
|
||||
|
||||
Iterator it;
|
||||
ILexComponent lc;
|
||||
|
||||
LexComponentRepository.beginTransaction();
|
||||
|
||||
String queryString = " FROM org.thdl.lex.component.LexComponent comp where metaId";
|
||||
Query query = LexComponentRepository.getSession().createQuery( queryString );
|
||||
it = query.iterate();
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
lc = (ILexComponent) it.next();
|
||||
|
||||
System.out.println( "Saving: " + lc.toString() );
|
||||
|
||||
try
|
||||
{
|
||||
LexComponentRepositoryDataTransfer.beginTransaction();
|
||||
LexComponentRepositoryDataTransfer.getSession().save( lc );
|
||||
LexComponentRepositoryDataTransfer.endTransaction( true );
|
||||
LexComponentRepositoryDataTransfer.getSession().evict( lc );
|
||||
LexComponentRepository.getSession().evict( lc );
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
LexComponentRepositoryDataTransfer.endTransaction( false );
|
||||
throw he;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LexComponentRepository.endTransaction( false );
|
||||
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The main program for the ConvertDataToNewMapping class
|
||||
*
|
||||
* @param args The command line arguments
|
||||
*/
|
||||
public static void main( String[] args )
|
||||
{
|
||||
file = new java.io.File( args[0] );
|
||||
//ConvertDataToNewMapping.convertLexComponents();
|
||||
//ConvertDataToNewMapping.convertTerms();
|
||||
ConvertDataToNewMapping.writeCredits();
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,13 @@ import java.sql.*;
|
|||
|
||||
public class DictionaryImporter
|
||||
{
|
||||
private static final String INSERT_META = "INSERT INTO meta (createdby, modifiedby, createdbyprojsub, modifiedbyprojsub, createdon,"
|
||||
+ "modifiedon, source, language, dialect, script, note) VALUES ( ?, ? , ?, ?, NOW(), NOW(), 0, 0, 0, 1, ?)";
|
||||
private static final String SELECT_META = "SELECT metaid FROM terms WHERE term = ?";
|
||||
private static final String INSERT_TERM = "INSERT INTO terms (metaid, term) VALUES (?,?)";
|
||||
private static final String UPDATE_TRANS = "UPDATE transitionaldata SET transitionaldatatext = ? WHERE metaid = ?";
|
||||
private static final String INSERT_TRANS = "INSERT INTO transitionaldata (metaid, parentid, precedence, transitionaldatalabel, forpublicconsumption, "
|
||||
+"transitionaldatatext) VALUES (?, ?, ?, ?, ?, ? )";
|
||||
private static PrintWriter out;
|
||||
private static BufferedReader in;
|
||||
private static String delimiter;
|
||||
|
@ -21,7 +28,12 @@ public class DictionaryImporter
|
|||
private static Integer label;
|
||||
private static Statement sqlStatement;
|
||||
private static Connection conn;
|
||||
|
||||
private static PreparedStatement insertMetaStmt;
|
||||
private static PreparedStatement selectMetaStmt;
|
||||
private static PreparedStatement insertTermStmt;
|
||||
private static PreparedStatement updateTransStmt;
|
||||
private static PreparedStatement insertTransStmt;
|
||||
|
||||
public final static int delimiterGeneric=0;
|
||||
public final static int delimiterAcip=1;
|
||||
public final static int delimiterDash=2;
|
||||
|
@ -93,8 +105,15 @@ public class DictionaryImporter
|
|||
Boolean result;
|
||||
ResultSet set;
|
||||
int metaID, metaIDTrans, prec;
|
||||
String currentDef, insertMeta = "INSERT INTO meta (createdby, modifiedby, createdbyprojsub, modifiedbyprojsub, createdon, modifiedon, source, language, dialect, script, note) VALUES (" + creator.toString() + ", " + creator.toString() + ", " + proj.toString() + ", " + proj.toString() + ", NOW(), NOW(), 0, 0, 0, 1, \"" + note + "\")";
|
||||
String currentDef;
|
||||
|
||||
insertMetaStmt.setString( 1, creator.toString() );
|
||||
insertMetaStmt.setString( 2, creator.toString() );
|
||||
insertMetaStmt.setString( 3, proj.toString() );
|
||||
insertMetaStmt.setString( 4, proj.toString() );
|
||||
insertMetaStmt.setString( 5, note );
|
||||
|
||||
|
||||
definition = Manipulate.replace(definition, "\\", "@@@@");
|
||||
definition = Manipulate.replace(definition, "@@@@", "\\\\");
|
||||
|
||||
|
@ -105,18 +124,21 @@ public class DictionaryImporter
|
|||
// System.out.println(term);
|
||||
|
||||
// Check to see if term is already there
|
||||
sqlStatement.execute("SELECT metaid FROM terms WHERE term = \"" + term + "\"");
|
||||
set = sqlStatement.getResultSet();
|
||||
selectMetaStmt.setString( 1 , term );
|
||||
set = selectMetaStmt.getResultSet();
|
||||
|
||||
// if it is get its metaID, else add it
|
||||
if (!set.first())
|
||||
{
|
||||
sqlStatement.execute(insertMeta);
|
||||
insertMetaStmt.execute();
|
||||
sqlStatement.execute("SELECT MAX(metaid) FROM META");
|
||||
set = sqlStatement.getResultSet();
|
||||
set.first();
|
||||
metaID = set.getInt(1);
|
||||
sqlStatement.execute("INSERT INTO terms (metaid, term) VALUES (" + metaID + ", \"" + term + "\")");
|
||||
|
||||
insertTermStmt.setInt( 1, metaID );
|
||||
insertTermStmt.setString(2, term );
|
||||
insertTermStmt.execute();
|
||||
}
|
||||
else metaID = set.getInt(1);
|
||||
|
||||
|
@ -139,7 +161,9 @@ public class DictionaryImporter
|
|||
{
|
||||
if (!currentDef.equals("")) definition = currentDef + ". " + definition;
|
||||
metaIDTrans = set.getInt(2);
|
||||
sqlStatement.execute("UPDATE transitionaldata SET transitionaldatatext = \"" + definition + "\" WHERE metaid = " + metaIDTrans);
|
||||
updateTransStmt.setString( 1, currentDef );
|
||||
updateTransStmt.setInt( 1, metaIDTrans );
|
||||
updateTransStmt.execute();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -153,7 +177,14 @@ public class DictionaryImporter
|
|||
set = sqlStatement.getResultSet();
|
||||
if (set.first()) prec = set.getInt(1)+1;
|
||||
else prec = 0;
|
||||
sqlStatement.execute("INSERT INTO transitionaldata (metaid, parentid, precedence, transitionaldatalabel, forpublicconsumption, transitionaldatatext) VALUES ("+ metaIDTrans +", " + metaID +", " + prec + ", " + label + ", \"" + publicCons + "\", \"" + definition + "\")");
|
||||
|
||||
insertTransStmt.setInt( 1, metaIDTrans );
|
||||
insertTransStmt.setInt( 2, metaID );
|
||||
insertTransStmt.setInt( 3, prec );
|
||||
insertTransStmt.setInt( 4, label );
|
||||
insertTransStmt.setInt( 5, publicCons );
|
||||
insertTransStmt.setString( 6, definition );
|
||||
insertTransStmt.execute();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,16 +323,12 @@ public class DictionaryImporter
|
|||
}
|
||||
|
||||
/** Used only if the database is being accessed manually instead of through Hibernate */
|
||||
private static Statement getStatement()
|
||||
private static void initConnections()
|
||||
{
|
||||
ResourceBundle rb = ResourceBundle.getBundle("dictionary-importer");
|
||||
Statement s = null;
|
||||
|
||||
// Loading driver
|
||||
try {
|
||||
// The newInstance() call is a work around for some
|
||||
// broken Java implementations
|
||||
|
||||
Class.forName(rb.getString("dictionaryimporter.driverclassname")).newInstance();
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Mysql driver couldn't be loaded!");
|
||||
|
@ -311,19 +338,35 @@ public class DictionaryImporter
|
|||
// Connecting to database
|
||||
try {
|
||||
conn = DriverManager.getConnection(rb.getString("dictionaryimporter.url"));
|
||||
s = conn.createStatement();
|
||||
|
||||
// Do something with the Connection
|
||||
|
||||
conn2 = DriverManager.getConnection(rb.getString("dictionaryimporter.url"));
|
||||
conn3 = DriverManager.getConnection(rb.getString("dictionaryimporter.url"));
|
||||
conn4 = DriverManager.getConnection(rb.getString("dictionaryimporter.url"));
|
||||
conn5 = DriverManager.getConnection(rb.getString("dictionaryimporter.url"));
|
||||
} catch (Exception ex) {
|
||||
// handle any errors
|
||||
System.out.println("Could not connect to database!");
|
||||
ex.printStackTrace();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
private static void initStatements()
|
||||
{
|
||||
try {
|
||||
sqlStatement = conn.createStatement();
|
||||
insertMetaStmt = conn.prepareStatement( INSERT_META );
|
||||
selectMetaStmt = conn.prepareStatement( SELECT_META );
|
||||
insertTermStmt = conn.prepareStatement( INSERT_TERM );
|
||||
updateTransStmt = conn.prepareStatement( UPDATE_TRANS );
|
||||
insertTransStmt = conn.prepareStatement( INSERT_TRANS );
|
||||
} catch (Exception ex) {
|
||||
// handle any errors
|
||||
System.out.println("Could not create statement!");
|
||||
ex.printStackTrace();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
public DictionaryImporter()
|
||||
{
|
||||
}
|
||||
|
@ -363,7 +406,8 @@ public class DictionaryImporter
|
|||
currentArg++;
|
||||
if (option.equals("manual"))
|
||||
{
|
||||
sqlStatement = getStatement();
|
||||
initConnections();
|
||||
initStatements();
|
||||
} else if (option.equals("format"))
|
||||
{
|
||||
if (argNum<=currentArg)
|
||||
|
|
107
src/java/org/thdl/lex/util/HibernateSessionDataTransfer.java
Normal file
107
src/java/org/thdl/lex/util/HibernateSessionDataTransfer.java
Normal file
|
@ -0,0 +1,107 @@
|
|||
package org.thdl.lex.util;
|
||||
|
||||
import net.sf.hibernate.*;
|
||||
import net.sf.hibernate.cfg.*;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author Hibernate WIKI
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class HibernateSessionTEMP
|
||||
{
|
||||
|
||||
private static SessionFactory sessionFactory;
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static ThreadLocal session = new ThreadLocal();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public static File config;
|
||||
public static String configResource;
|
||||
public static void setConfigResource(String configResource) {
|
||||
HibernateSessionTEMP.configResource = configResource;
|
||||
}
|
||||
public static String getConfigResource() {
|
||||
return configResource;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the config attribute of the HibernateSessionTEMP object
|
||||
*
|
||||
* @param config The new config value
|
||||
*/
|
||||
public static void setConfig( File config )
|
||||
{
|
||||
HibernateSessionTEMP.config = config;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the config attribute of the HibernateSessionTEMP object
|
||||
*
|
||||
* @return The config value
|
||||
*/
|
||||
public static File getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @return Description of the Returned Value
|
||||
* @exception HibernateException Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static Session currentSession()
|
||||
throws HibernateException
|
||||
{
|
||||
|
||||
Session s = (Session) session.get();
|
||||
if ( s == null )
|
||||
{
|
||||
|
||||
// Don't get from JNDI, use a static SessionFactory
|
||||
if ( sessionFactory == null )
|
||||
{
|
||||
|
||||
// Use default hibernate.cfg.xml
|
||||
sessionFactory = new Configuration().configure( getConfig() ).buildSessionFactory();
|
||||
|
||||
}
|
||||
|
||||
s = sessionFactory.openSession();
|
||||
session.set( s );
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception HibernateException Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void closeSession()
|
||||
throws HibernateException
|
||||
{
|
||||
|
||||
Session s = (Session) session.get();
|
||||
session.set( null );
|
||||
if ( s != null )
|
||||
{
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package org.thdl.lex.util;
|
||||
|
||||
import net.sf.hibernate.*;
|
||||
import net.sf.hibernate.cfg.*;
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author Hibernate WIKI
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class HibernateTransactionTEMP
|
||||
{
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static ThreadLocal transaction = new ThreadLocal();
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception HibernateException Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void beginTransaction() throws HibernateException
|
||||
{
|
||||
|
||||
Transaction t = (Transaction) transaction.get();
|
||||
if ( t == null )
|
||||
{
|
||||
t = HibernateSessionTEMP.currentSession().beginTransaction();
|
||||
transaction.set( t );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param commit Description of the Parameter
|
||||
* @exception HibernateException Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void endTransaction( boolean commit ) throws HibernateException
|
||||
{
|
||||
Transaction t = (Transaction) transaction.get();
|
||||
transaction.set( null );
|
||||
if ( t != null )
|
||||
{
|
||||
if ( commit )
|
||||
{
|
||||
t.commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
t.rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
471
src/java/org/thdl/lex/util/LexComponentDataTransfer.hbm.xml
Normal file
471
src/java/org/thdl/lex/util/LexComponentDataTransfer.hbm.xml
Normal file
|
@ -0,0 +1,471 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
|
||||
<hibernate-mapping default-cascade="all">
|
||||
|
||||
<!-- <class name="org.thdl.lex.component.LexComponent" proxy="org.thdl.lex.component.ILexComponent" table="Meta" where="deleted=0" unsaved-value="0"> -->
|
||||
<class name="org.thdl.lex.component.LexComponent" proxy="org.thdl.lex.component.ILexComponent" table="Meta" where="deleted=0">
|
||||
|
||||
<meta attribute="generated-class" inherit="false">org.thdl.lex.component.BaseLexComponent</meta>
|
||||
|
||||
<id name="metaId" type="java.lang.Integer" column="metaId">
|
||||
<!-- <meta attribute="finder-method">findById</meta> -->
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
|
||||
<!--<property name="translationOf" type="java.lang.Integer" column="translationOf" length="11"/> -->
|
||||
|
||||
<property name="deleted" type="java.lang.Boolean" column="deleted" not-null="true" length="5"/>
|
||||
<many-to-one name="parentTerm" class="org.thdl.lex.component.Term" column="parentTermId" insert="false" update="false"/>
|
||||
|
||||
<list name="analyticalNotes" inverse="true" table="AnalyticalNotes" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.AnalyticalNote"/>
|
||||
</list>
|
||||
|
||||
<component name="meta" class="org.thdl.lex.component.Meta">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseMeta</meta>
|
||||
<property name="createdBy" type="java.lang.Integer" column="createdBy" not-null="true" length="11"/>
|
||||
<property name="modifiedBy" type="java.lang.Integer" column="modifiedBy" not-null="true" length="11"/>
|
||||
<property name="createdByProjSub" type="java.lang.Integer" column="createdByProjSub" not-null="true" length="11"/>
|
||||
<property name="modifiedByProjSub" type="java.lang.Integer" column="modifiedByProjSub" not-null="true" length="11"/>
|
||||
<property name="createdOn" type="java.sql.Timestamp" column="createdOn" length="14"/>
|
||||
<property name="modifiedOn" type="java.sql.Timestamp" column="modifiedOn" length="14"/>
|
||||
<property name="source" type="java.lang.Integer" column="source" not-null="true" length="11"/>
|
||||
<property name="language" type="java.lang.Integer" column="language" not-null="true" length="6"/>
|
||||
<property name="script" type="java.lang.Integer" column="script" not-null="true" length="6"/>
|
||||
<property name="dialect" type="java.lang.Integer" column="dialect" not-null="true" length="6"/>
|
||||
<property name="note" type="java.lang.String" column="note" length="65535"/>
|
||||
</component>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.AnalyticalNote" proxy="org.thdl.lex.component.IAnalyticalNote" table="AnalyticalNotes">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseAnalyticalNote</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="analyticalNote" type="java.lang.String" column="analyticalNote" length="65535"/>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.Term" proxy="org.thdl.lex.component.ITerm" table="Terms">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseTerm</meta>
|
||||
<meta attribute="implements">org.thdl.lex.component.LexComponentNode</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="term" type="java.lang.String" column="term" not-null="true" length="255">
|
||||
<!-- <meta attribute="finder-method">findByTerm</meta> -->
|
||||
</property>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<component name="credits" class="org.thdl.lex.component.Credits">
|
||||
<property name="createdBy" type="java.lang.Integer" column="createdBy" not-null="true" length="11"/>
|
||||
<property name="modifiedBy" type="java.lang.Integer" column="modifiedBy" not-null="true" length="11"/>
|
||||
<property name="createdByProjSub" type="java.lang.Integer" column="createdByProjSub" not-null="true" length="11"/>
|
||||
<property name="modifiedByProjSub" type="java.lang.Integer" column="modifiedByProjSub" not-null="true" length="11"/>
|
||||
<property name="createdOn" type="java.sql.Timestamp" column="createdOn" length="14"/>
|
||||
<property name="modifiedOn" type="java.sql.Timestamp" column="modifiedOn" length="14"/>
|
||||
<property name="source" type="java.lang.Integer" column="source" not-null="true" length="11"/>
|
||||
<property name="language" type="java.lang.Integer" column="language" not-null="true" length="6"/>
|
||||
<property name="script" type="java.lang.Integer" column="script" not-null="true" length="6"/>
|
||||
<property name="dialect" type="java.lang.Integer" column="dialect" not-null="true" length="6"/>
|
||||
<property name="note" type="java.lang.String" column="note" length="65535"/>
|
||||
</component>
|
||||
|
||||
<list name="pronunciations" inverse="true" table="Pronunciations" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Pronunciation"/>
|
||||
</list>
|
||||
<list name="etymologies" inverse="true" table="Etymologies" lazy="true" where="translationOf IS NULL">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Etymology"/>
|
||||
</list>
|
||||
<list name="spellings" inverse="true" table="Spellings" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Spelling"/>
|
||||
</list>
|
||||
<list name="functions" inverse="true" table="GrammaticalFunctions" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.GrammaticalFunction"/>
|
||||
</list>
|
||||
<list name="encyclopediaArticles" inverse="true" table="EncyclopediaArticles" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.EncyclopediaArticle"/>
|
||||
</list>
|
||||
<list name="transitionalData" inverse="true" table="TransitionalData" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.TransitionalData"/>
|
||||
</list>
|
||||
<list name="definitions" inverse="true" table="Definitions" lazy="true" where="translationOf IS NULL">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Definition"/>
|
||||
</list>
|
||||
<list name="glosses" inverse="true" table="Glosses" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Gloss"/>
|
||||
</list>
|
||||
<list name="keywords" inverse="true" table="Keywords" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Keyword"/>
|
||||
</list>
|
||||
<list name="modelSentences" inverse="true" table="ModelSentences" lazy="true" where="translationOf IS NULL">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.ModelSentence"/>
|
||||
</list>
|
||||
<list name="translationEquivalents" inverse="true" table="TranslationEquivalents" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.TranslationEquivalent"/>
|
||||
</list>
|
||||
<list name="relatedTerms" inverse="true" table="RelatedTerms" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.RelatedTerm"/>
|
||||
</list>
|
||||
<list name="passages" inverse="true" table="Passages" lazy="true" where="translationOf IS NULL">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Passage"/>
|
||||
</list>
|
||||
<list name="registers" inverse="true" table="SpeechRegisters" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.SpeechRegister"/>
|
||||
</list>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.Definition" proxy="org.thdl.lex.component.IDefinition" table="Definitions">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseDefinition</meta>
|
||||
<meta attribute="implements">org.thdl.lex.component.Translatable, org.thdl.lex.component.LexComponentNode</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="definition" type="java.lang.String" column="definition" length="65535"/>
|
||||
<property name="translationOf" type="java.lang.Integer" column="translationOf" length="11"/>
|
||||
<list name="translations" inverse="true" table="Definitions" lazy="true" where="translationOf IS NOT NULL">
|
||||
<key column="translationOf"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Definition"/>
|
||||
</list>
|
||||
<list name="subdefinitions" inverse="true" table="Subdefinitions" lazy="true" where="translationOf IS NULL">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Subdefinition"/>
|
||||
</list>
|
||||
<list name="glosses" inverse="true" table="Glosses" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Gloss"/>
|
||||
</list>
|
||||
<list name="keywords" inverse="true" table="Keywords" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Keyword"/>
|
||||
</list>
|
||||
<list name="modelSentences" inverse="true" table="ModelSentences" lazy="true" where="translationOf IS NULL">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.ModelSentence"/>
|
||||
</list>
|
||||
<list name="translationEquivalents" inverse="true" table="TranslationEquivalents" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.TranslationEquivalent"/>
|
||||
</list>
|
||||
<list name="relatedTerms" inverse="true" table="RelatedTerms" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.RelatedTerm"/>
|
||||
</list>
|
||||
<list name="passages" inverse="true" table="Passages" lazy="true" where="translationOf IS NULL">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Passage"/>
|
||||
</list>
|
||||
<list name="registers" inverse="true" table="SpeechRegisters" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.SpeechRegister"/>
|
||||
</list>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.Subdefinition" proxy="org.thdl.lex.component.ISubdefinition" table="Subdefinitions">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseSubdefinition</meta>
|
||||
<meta attribute="implements">org.thdl.lex.component.Translatable, org.thdl.lex.component.LexComponentNode</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="subdefinition" type="java.lang.String" column="subdefinition" length="65535"/>
|
||||
<property name="translationOf" type="java.lang.Integer" column="translationOf" length="11"/>
|
||||
<list name="translations" inverse="true" table="Subdefinitions" lazy="true" where="translationOf IS NOT NULL">
|
||||
<key column="translationOf"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Subdefinition"/>
|
||||
</list>
|
||||
<list name="glosses" inverse="true" table="Glosses" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Gloss"/>
|
||||
</list>
|
||||
<list name="keywords" inverse="true" table="Keywords" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Keyword"/>
|
||||
</list>
|
||||
<list name="modelSentences" inverse="true" table="ModelSentences" lazy="true" where="translationOf IS NULL">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.ModelSentence"/>
|
||||
</list>
|
||||
<list name="translationEquivalents" inverse="true" table="TranslationEquivalents" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.TranslationEquivalent"/>
|
||||
</list>
|
||||
<list name="relatedTerms" inverse="true" table="RelatedTerms" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.RelatedTerm"/>
|
||||
</list>
|
||||
<list name="passages" inverse="true" table="Passages" lazy="true" where="translationOf IS NULL">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Passage"/>
|
||||
</list>
|
||||
<list name="registers" inverse="true" table="SpeechRegisters" lazy="true">
|
||||
<key column="parentId"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.SpeechRegister"/>
|
||||
</list>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.Pronunciation" proxy="org.thdl.lex.component.IPronunciation" table="Pronunciations">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BasePronunciation</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="phonetics" type="java.lang.String" column="phonetics" not-null="true" length="65535"/>
|
||||
<property name="phoneticsType" type="java.lang.Integer" column="phoneticsType" not-null="true" length="6"/>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.Etymology" proxy="org.thdl.lex.component.IEtymology" table="Etymologies">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseEtymology</meta>
|
||||
<meta attribute="implements">org.thdl.lex.component.Translatable</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="loanLanguage" type="java.lang.Integer" column="loanLanguage" length="6"/>
|
||||
<property name="etymologyType" type="java.lang.Integer" column="etymologyType" not-null="true" length="6"/>
|
||||
<property name="derivation" type="java.lang.String" column="derivation" not-null="true" length="255"/>
|
||||
<property name="etymologyDescription" type="java.lang.String" column="etymologyDescription" not-null="true" length="65535"/>
|
||||
<property name="translationOf" type="java.lang.Integer" column="translationOf" length="11"/>
|
||||
<list name="translations" inverse="true" table="Etymologies" lazy="true" where="translationOf IS NOT NULL">
|
||||
<key column="translationOf"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Etymology"/>
|
||||
</list>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.Spelling" proxy="org.thdl.lex.component.ISpelling" table="Spellings">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseSpelling</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="spelling" type="java.lang.String" column="spelling" not-null="true" length="255"/>
|
||||
<property name="spellingType" type="java.lang.Integer" column="spellingType" not-null="true" length="6"/>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.GrammaticalFunction" proxy="org.thdl.lex.component.IFunction" table="GrammaticalFunctions">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseGrammaticalFunction</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="function" type="java.lang.Integer" column="function" not-null="true" length="6"/>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.EncyclopediaArticle" proxy="org.thdl.lex.component.IEncyclopediaArticle" table="EncyclopediaArticles">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseEncyclopediaArticle</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="article" type="java.lang.String" column="article" not-null="true" length="65535"/>
|
||||
<property name="articleTitle" type="java.lang.String" column="articleTitle" not-null="true" length="65535"/>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.Gloss" proxy="org.thdl.lex.component.IGloss" table="Glosses">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseGloss</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="gloss" type="java.lang.String" column="gloss" length="65535"/>
|
||||
<property name="translation" type="java.lang.String" column="translation" length="65535"/>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.Keyword" proxy="org.thdl.lex.component.IKeyword" table="Keywords">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseKeyword</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="keyword" type="java.lang.String" column="keyword" length="65535"/>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.ModelSentence" proxy="org.thdl.lex.component.IModelSentence" table="ModelSentences">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseModelSentence</meta>
|
||||
<meta attribute="implements">org.thdl.lex.component.Translatable</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="modelSentence" type="java.lang.String" column="modelSentence" length="65535"/>
|
||||
<property name="translationOf" type="java.lang.Integer" column="translationOf" length="11"/>
|
||||
<list name="translations" inverse="true" table="ModelSentences" lazy="true" where="translationOf IS NOT NULL">
|
||||
<key column="translationOf"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.ModelSentence"/>
|
||||
</list>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.TranslationEquivalent" proxy="org.thdl.lex.component.ITranslationEquivalent" table="TranslationEquivalents">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseTranslationEquivalent</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="translationEquivalent" type="java.lang.String" column="translationEquivalent" length="65535"/>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.RelatedTerm" proxy="org.thdl.lex.component.IRelatedTerm" table="RelatedTerms">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseRelatedTerm</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="relatedTerm" type="java.lang.String" column="relatedTerm" length="65535"/>
|
||||
<property name="relatedTermType" type="java.lang.Integer" column="relatedTermType" not-null="true" length="6"/>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.Passage" proxy="org.thdl.lex.component.IPassage" table="LiteraryQuotations">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BasePassage</meta>
|
||||
<meta attribute="implements">org.thdl.lex.component.Translatable</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="literarySource" type="java.lang.String" column="literarySource" length="65535"/>
|
||||
<property name="spelling" type="java.lang.String" column="spelling" length="65535"/>
|
||||
<property name="pagination" type="java.lang.String" column="pagination" length="65535"/>
|
||||
<property name="passage" type="java.lang.String" column="passage" length="65535"/>
|
||||
<property name="translationOf" type="java.lang.Integer" column="translationOf" length="11"/>
|
||||
<list name="translations" inverse="true" table="LiteraryQuotations" lazy="true" where="translationOf IS NOT NULL">
|
||||
<key column="translationOf"/>
|
||||
<index column="precedence"/>
|
||||
<one-to-many class="org.thdl.lex.component.Passage"/>
|
||||
</list>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.SpeechRegister" proxy="org.thdl.lex.component.IRegister" table="SpeechRegisters">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseSpeechRegister</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="register" type="java.lang.Integer" column="register" not-null="true" length="6"/>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="org.thdl.lex.component.TransitionalData" proxy="org.thdl.lex.component.ITransitionalData" table="TransitionalData">
|
||||
<meta attribute="generated-class">org.thdl.lex.component.BaseTransitionalData</meta>
|
||||
<key column="metaId">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</key>
|
||||
<property name="parentId" type="java.lang.Integer" column="parentId" length="11">
|
||||
<!--<meta attribute="gen-property">false</meta>-->
|
||||
</property>
|
||||
<many-to-one name="parent" class="org.thdl.lex.component.LexComponent" column="parentId" insert="false" update="false"/>
|
||||
<!--<property name="precedence" type="java.lang.Integer" column="precedence" length="6"/>-->
|
||||
<property name="transitionalDataLabel" type="java.lang.Integer" column="transitionalDataLabel" length="6"/>
|
||||
<property name="forPublicConsumption" type="java.lang.String" column="forPublicConsumption" not-null="true" length="5"/>
|
||||
<property name="transitionalDataText" type="java.lang.String" column="transitionalDataText" length="65535"/>
|
||||
</joined-subclass>
|
||||
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
||||
|
|
@ -0,0 +1,898 @@
|
|||
package org.thdl.lex;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.sf.hibernate.*;
|
||||
import org.apache.log4j.*;
|
||||
|
||||
import org.thdl.lex.component.*;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class LexComponentRepositoryTEMP
|
||||
{
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String EXACT = "exact";
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String STARTS_WITH = "startsWith";
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String ANYWHERE = "anywhere";
|
||||
private static long start;
|
||||
|
||||
private static long lastUpdate = now();
|
||||
|
||||
|
||||
/**
|
||||
* Sets the lastUpdate attribute of the LexComponentRepository class
|
||||
*
|
||||
* @param last The new lastUpdate value
|
||||
*/
|
||||
public static void setLastUpdate( long last )
|
||||
{
|
||||
lastUpdate = last;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the lastUpdate attribute of the LexComponentRepository class
|
||||
*
|
||||
* @return The lastUpdate value
|
||||
*/
|
||||
public static long getLastUpdate()
|
||||
{
|
||||
return lastUpdate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the start attribute of the LexComponentRepository object
|
||||
*
|
||||
* @param startTime The new start value
|
||||
* @since
|
||||
*/
|
||||
private static void setStart( long startTime )
|
||||
{
|
||||
Logger logger = Logger.getLogger( "org.thdl.lex" );
|
||||
logger.debug( "Query start time: " + new java.util.Date( startTime ) );
|
||||
start = startTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the start attribute of the LexComponentRepository object
|
||||
*
|
||||
* @return The start value
|
||||
* @since
|
||||
*/
|
||||
private static long getStart()
|
||||
{
|
||||
return start;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the duration attribute of the LexComponentRepository class
|
||||
*
|
||||
* @return The duration value
|
||||
*/
|
||||
private static long getDuration()
|
||||
{
|
||||
long duration = now() - getStart();
|
||||
|
||||
Logger logger = Logger.getLogger( "org.thdl.lex" );
|
||||
logger.debug( "Query finish: " + new java.util.Date( now() ) );
|
||||
logger.debug( "Query duration in ms: " + duration );
|
||||
logger.info( "Query duration: " + duration / 1000 + " seconds." );
|
||||
return duration;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the session attribute of the LexComponentRepository class
|
||||
*
|
||||
* @return The session value
|
||||
* @exception HibernateException Description of Exception
|
||||
* @since
|
||||
*/
|
||||
protected static Session getSession() throws HibernateException
|
||||
{
|
||||
Session session = HibernateSessionTEMP.currentSession();
|
||||
if ( !session.isConnected() )
|
||||
{
|
||||
//session.reconnect();
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
protected static void beginTransaction() throws LexRepositoryException
|
||||
{
|
||||
try
|
||||
{
|
||||
HibernateTransactionTEMP.beginTransaction();
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param commit Description of Parameter
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
* @since
|
||||
*/
|
||||
protected static void endTransaction( boolean commit ) throws LexRepositoryException
|
||||
{
|
||||
try
|
||||
{
|
||||
HibernateTransactionTEMP.endTransaction( commit );
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @return Description of the Returned Value
|
||||
* @since
|
||||
*/
|
||||
private static long now()
|
||||
{
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param comp Description of Parameter
|
||||
* @return Description of the Returned Value
|
||||
* @exception LexRepositoryException Description of Exception
|
||||
* @since
|
||||
*/
|
||||
private static ITerm assertTerm( ILexComponent comp ) throws LexRepositoryException
|
||||
{
|
||||
ITerm term = null;
|
||||
try
|
||||
{
|
||||
term = (ITerm) comp;
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
throw new LexRepositoryException( "Query Component was not a term." );
|
||||
}
|
||||
return term;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Queries the database for Terms that start with the string in the term
|
||||
* property of the queryComponent. Sets entry property the first hit returned.
|
||||
*
|
||||
* @param lexQuery Description of Parameter
|
||||
* @exception LexRepositoryException Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void findTermsByTerm( LexQuery lexQuery ) throws LexRepositoryException
|
||||
{
|
||||
setStart( now() );
|
||||
beginTransaction();
|
||||
ITerm term = assertTerm( lexQuery.getQueryComponent() );
|
||||
if ( null == term.getTerm() )
|
||||
{
|
||||
throw new LexRepositoryException( "Query Component term was null." );
|
||||
}
|
||||
|
||||
Query query = null;
|
||||
Iterator it = null;
|
||||
|
||||
String termForQuery = LexUtilities.hqlEscape( term.getTerm() );
|
||||
LexLogger.debug( "Escaped term string: " + termForQuery );
|
||||
|
||||
if ( lexQuery.getFindMode().equals( LexComponentRepository.STARTS_WITH ) )
|
||||
{
|
||||
termForQuery = termForQuery + "%";
|
||||
}
|
||||
else if ( lexQuery.getFindMode().equals( LexComponentRepository.ANYWHERE ) )
|
||||
{
|
||||
termForQuery = "%" + termForQuery + "%";
|
||||
}
|
||||
|
||||
String queryString = " FROM org.thdl.lex.component.ITerm as term WHERE term like :term AND term.deleted=0 ORDER BY term";
|
||||
try
|
||||
{
|
||||
query = getSession().createQuery( queryString );
|
||||
query.setString( "term", termForQuery );
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
it = query.iterate();
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
|
||||
if ( it.hasNext() )
|
||||
{
|
||||
term = (ITerm) it.next();
|
||||
lexQuery.setEntry( term );
|
||||
lexQuery.getResults().clear();
|
||||
lexQuery.getResults().put( term.getMetaId(), term.getTerm() );
|
||||
}
|
||||
else
|
||||
{
|
||||
lexQuery.setEntry( null );
|
||||
lexQuery.getResults().clear();
|
||||
}
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
term = (ITerm) it.next();
|
||||
lexQuery.getResults().put( term.getMetaId(), term.getTerm() );
|
||||
}
|
||||
endTransaction( false );
|
||||
lexQuery.setDuration( getDuration() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param pk Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public static ITerm findTermByPk( Integer pk ) throws LexRepositoryException
|
||||
{
|
||||
ITerm term = null;
|
||||
|
||||
beginTransaction();
|
||||
String queryString = " FROM org.thdl.lex.component.ITerm as term WHERE term.metaId = " + pk.toString();
|
||||
try
|
||||
{
|
||||
Query query = getSession().createQuery( queryString );
|
||||
term = (ITerm) query.uniqueResult();
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
endTransaction( false );
|
||||
return term;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param lexQuery Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public static Map findTermsByMeta( LexQuery lexQuery ) throws LexRepositoryException
|
||||
{
|
||||
Logger logger = Logger.getLogger( "org.thdl.lex" );
|
||||
ITerm term = assertTerm( lexQuery.getQueryComponent() );
|
||||
Map terms = new HashMap();
|
||||
ILexComponent comp = null;
|
||||
ITerm aTerm;
|
||||
Query query = null;
|
||||
Iterator it = null;
|
||||
|
||||
setStart( now() );
|
||||
beginTransaction();
|
||||
if ( null == term.getMeta() )
|
||||
{
|
||||
throw new LexRepositoryException( "Query Component term.meta was null." );
|
||||
}
|
||||
|
||||
if ( logger.isDebugEnabled() )
|
||||
{
|
||||
logger.debug( "Tibetan Dictionary begin query!" );
|
||||
}
|
||||
String queryString = "select term from org.thdl.lex.component.Term as term "
|
||||
//join term collections
|
||||
+ " join term.pronunciations as pron "
|
||||
+ " join term.etymologies as ety "
|
||||
+ " join term.spellings as sp "
|
||||
+ " join term.functions as func "
|
||||
+ " join term.encyclopediaArticles as ency "
|
||||
+ " join term.transitionalData as transData "
|
||||
+ " join term.definitions as def "
|
||||
+ " join term.glosses as glo "
|
||||
+ " join term.keywords as key "
|
||||
+ " join term.translationEquivalents as trans "
|
||||
+ " join term.relatedTerms as rel "
|
||||
+ " join term.passages as pass "
|
||||
+ " join term.registers as reg "
|
||||
//join def collections
|
||||
+ " join def.subdefinitions as sub "
|
||||
+ " join def.glosses as gloDef "
|
||||
+ " join def.keywords as keyDef "
|
||||
+ " join def.modelSentences as modDef "
|
||||
+ " join def.translationEquivalents as transDef "
|
||||
+ " join def.relatedTerms as relDef "
|
||||
+ " join def.passages as passDef "
|
||||
+ " join def.registers as regDef "
|
||||
//join subdef collections
|
||||
+ " join sub.glosses as gloSub "
|
||||
+ " join sub.keywords as keySub "
|
||||
+ " join sub.modelSentences as modSub "
|
||||
+ " join sub.translationEquivalents as transSub "
|
||||
+ " join sub.relatedTerms as relSub "
|
||||
+ " join sub.passages as passSub "
|
||||
+ " join sub.registers as regSub "
|
||||
// join translation collections
|
||||
/* + " join ety.translations as etyTrans "
|
||||
+ " join term.definitions.translations as defTrans "
|
||||
+ " join term.modelSentences.translations as modTrans "
|
||||
+ " join term.passages.translations as passTrans "
|
||||
+ " join def.subdefinition.translations as subTrans "
|
||||
+ " join def.modelSentences.translations as modDefTrans "
|
||||
+ " join def.passages.translations as passDefTrans "
|
||||
+ " join sub.modelSentences.translations as modSubTrans "
|
||||
+ " join sub.passages.translations as passSubTrans " */
|
||||
//restrict by projectSubject in createdByProjSub
|
||||
+ " where term.meta.createdByProjSub = :projSub"
|
||||
+ " or pron.meta.createdByProjSub = :projSub"
|
||||
+ " or ety.meta.createdByProjSub = :projSub"
|
||||
+ " or sp.meta.createdByProjSub = :projSub"
|
||||
+ " or func.meta.createdByProjSub = :projSub"
|
||||
+ " or ency.meta.createdByProjSub = :projSub"
|
||||
+ " or transData.meta.createdByProjSub = :projSub"
|
||||
+ " or def.meta.createdByProjSub = :projSub"
|
||||
+ " or glo.meta.createdByProjSub = :projSub"
|
||||
+ " or key.meta.createdByProjSub = :projSub"
|
||||
+ " or trans.meta.createdByProjSub = :projSub"
|
||||
+ " or rel.meta.createdByProjSub = :projSub"
|
||||
+ " or pass.meta.createdByProjSub = :projSub"
|
||||
+ " or reg.meta.createdByProjSub = :projSub"
|
||||
+ " or subDef.meta.createdByProjSub = :projSub"
|
||||
+ " or gloDef.meta.createdByProjSub = :projSub"
|
||||
+ " or keyDef.meta.createdByProjSub = :projSub"
|
||||
+ " or modDef.meta.createdByProjSub = :projSub"
|
||||
+ " or transDef.meta.createdByProjSub = :projSub"
|
||||
+ " or relDef.meta.createdByProjSub = :projSub"
|
||||
+ " or passDef.meta.createdByProjSub = :projSub"
|
||||
+ " or regDef.meta.createdByProjSub = :projSub"
|
||||
+ " or gloSub.meta.createdByProjSub = :projSub"
|
||||
+ " or keySub.meta.createdByProjSub = :projSub"
|
||||
+ " or modSub.meta.createdByProjSub = :projSub"
|
||||
+ " or transSub.meta.createdByProjSub = :projSub"
|
||||
+ " or relSub.meta.createdByProjSub = :projSub"
|
||||
+ " or passSub.meta.createdByProjSub = :projSub"
|
||||
+ " or regSub.meta.createdByProjSub = :projSub"
|
||||
+ " or etyTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or defTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or modTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or passTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or subTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or modDefTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or passDefTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or modSubTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or passSubTrans.meta.createdByProjSub = :projSub"
|
||||
//restrict by projectSubject in modifiedByProjSub
|
||||
+ " or term.meta.modifiedByProjSub = :projSub"
|
||||
+ " or pron.meta.modifiedByProjSub = :projSub"
|
||||
+ " or ety.meta.modifiedByProjSub = :projSub"
|
||||
+ " or sp.meta.modifiedByProjSub = :projSub"
|
||||
+ " or func.meta.modifiedByProjSub = :projSub"
|
||||
+ " or ency.meta.modifiedByProjSub = :projSub"
|
||||
+ " or trans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or def.meta.modifiedByProjSub = :projSub"
|
||||
+ " or glo.meta.modifiedByProjSub = :projSub"
|
||||
+ " or key.meta.modifiedByProjSub = :projSub"
|
||||
+ " or trans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or rel.meta.modifiedByProjSub = :projSub"
|
||||
+ " or pass.meta.modifiedByProjSub = :projSub"
|
||||
+ " or reg.meta.modifiedByProjSub = :projSub"
|
||||
+ " or subDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or gloDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or keyDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or transDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or relDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or regDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or gloSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or keySub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or transSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or relSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passSub.meta.modifiedByProjSub = :projSub"
|
||||
/* + " or regSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or etyTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or defTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or subTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modDefTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passDefTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modSubTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passSubTrans.meta.modifiedByProjSub = :projSub";*/
|
||||
|
||||
+"";
|
||||
try
|
||||
{
|
||||
query = getSession().createQuery( queryString );
|
||||
//query.setMaxResults( 100 );
|
||||
query.setInteger( "projSub", lexQuery.getQueryComponent().getMeta().getCreatedByProjSub().intValue() );
|
||||
logger.debug( "About to list query" );
|
||||
List list = query.list();
|
||||
logger.debug( "results size: " + list.size() );
|
||||
it = list.iterator();
|
||||
logger.debug( "Starting to add terms to map" );
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
aTerm = (ITerm) comp;
|
||||
logger.debug( "successfully cast comp to an ITerm" );
|
||||
terms.put( aTerm.getMetaId(), aTerm.getTerm() );
|
||||
}
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
endTransaction( false );
|
||||
lexQuery.setDuration( getDuration() );
|
||||
return terms;
|
||||
}
|
||||
public static Map findTermsByMetaViaLc( LexQuery lexQuery ) throws LexRepositoryException
|
||||
{
|
||||
Logger logger = Logger.getLogger( "org.thdl.lex" );
|
||||
ITerm term = assertTerm( lexQuery.getQueryComponent() );
|
||||
Map terms = new HashMap();
|
||||
ILexComponent comp = null;
|
||||
ITerm aTerm;
|
||||
Query query = null;
|
||||
Iterator it = null;
|
||||
|
||||
setStart( now() );
|
||||
beginTransaction();
|
||||
if ( null == term.getMeta() )
|
||||
{
|
||||
throw new LexRepositoryException( "Query Component term.meta was null." );
|
||||
}
|
||||
|
||||
if ( logger.isDebugEnabled() )
|
||||
{
|
||||
logger.debug( "Tibetan Dictionary begin query!" );
|
||||
}
|
||||
String queryString = "from org.thdl.lex.component.LexComponent as comp where comp.meta.createdByProjSub=:projSub";
|
||||
|
||||
try
|
||||
{
|
||||
query = getSession().createQuery( queryString );
|
||||
//query.setMaxResults( 100 );
|
||||
query.setInteger( "projSub", lexQuery.getQueryComponent().getMeta().getCreatedByProjSub().intValue() );
|
||||
logger.debug( "About to list query" );
|
||||
List list = query.list();
|
||||
logger.debug( "results size: " + list.size() );
|
||||
it = list.iterator();
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
logger.debug( "Starting quest for a term parent" );
|
||||
|
||||
comp = (ILexComponent) it.next();
|
||||
int safetyFirst = 0;
|
||||
while ( !( comp instanceof ITerm ) && comp != null )
|
||||
{
|
||||
logger.debug( "comp class: " + comp.getClass().getName() );
|
||||
comp = comp.getParent();
|
||||
if ( comp instanceof ITerm )
|
||||
{
|
||||
try
|
||||
{
|
||||
aTerm = (ITerm) comp;
|
||||
terms.put( aTerm.getMetaId(), aTerm.getTerm() );
|
||||
logger.debug( "successfully cast comp to an ITerm" );
|
||||
}
|
||||
catch ( ClassCastException cce )
|
||||
{
|
||||
logger.debug( "LCR caught ClassCastException Failed cast of " +comp.toString() + " to ITerm" );
|
||||
throw cce;
|
||||
}
|
||||
}
|
||||
|
||||
safetyFirst++;
|
||||
if ( safetyFirst > 10 )
|
||||
{
|
||||
logger.debug( "could not find an ITerm parent for component: " + comp );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
endTransaction( false );
|
||||
lexQuery.setDuration( getDuration() );
|
||||
return terms;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param term Description of the Parameter
|
||||
* @exception LexRepositoryException Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void loadTerm( ITerm term ) throws LexRepositoryException
|
||||
{
|
||||
try
|
||||
{
|
||||
beginTransaction();
|
||||
getSession().load( term, term.getMetaId() );
|
||||
endTransaction( false );
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param lexQuery Description of the Parameter
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public static void loadTermByPk( LexQuery lexQuery ) throws LexRepositoryException
|
||||
{
|
||||
beginTransaction();
|
||||
ITerm term = assertTerm( lexQuery.getQueryComponent() );
|
||||
loadTerm( term );
|
||||
lexQuery.setEntry( term );
|
||||
if ( !lexQuery.getResults().containsKey( term.getMetaId() ) )
|
||||
{
|
||||
lexQuery.getResults().put( term.getMetaId(), term.getTerm() );
|
||||
}
|
||||
endTransaction( false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component Description of the Parameter
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public static void loadByPk( ILexComponent component ) throws LexRepositoryException
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
beginTransaction();
|
||||
getSession().load( component, component.getMetaId() );
|
||||
endTransaction( false );
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component Description of the Parameter
|
||||
* @param pk Description of the Parameter
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public static void loadByPk( ILexComponent component, Integer pk ) throws LexRepositoryException
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
beginTransaction();
|
||||
getSession().load( component, pk );
|
||||
endTransaction( false );
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the recentTerms attribute of the LexComponentRepository class
|
||||
*
|
||||
* @param limit Description of the Parameter
|
||||
* @return The recentTerms value
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public static List getRecentTerms( int limit ) throws LexRepositoryException
|
||||
{
|
||||
Query query = null;
|
||||
List results = null;
|
||||
String queryString = " FROM org.thdl.lex.component.ITerm ORDER BY modifiedOn DESC LIMIT " + limit;
|
||||
try
|
||||
{
|
||||
beginTransaction();
|
||||
query = getSession().createQuery( queryString );
|
||||
results = query.list();
|
||||
endTransaction( false );
|
||||
getSession().clear();
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component Description of the Parameter
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public static void save( ILexComponent component ) throws LexRepositoryException
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
beginTransaction();
|
||||
getSession().saveOrUpdate( component );
|
||||
endTransaction( true );
|
||||
setLastUpdate( now() );
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component Description of the Parameter
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public static void update( ILexComponent component ) throws LexRepositoryException
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
beginTransaction();
|
||||
getSession().update( component );
|
||||
endTransaction( true );
|
||||
setLastUpdate( now() );
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component Description of the Parameter
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public static void remove( ILexComponent component ) throws LexRepositoryException
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
beginTransaction();
|
||||
getSession().delete( component );
|
||||
endTransaction( true );
|
||||
setLastUpdate( now() );
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component Description of the Parameter
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public static void refresh( ILexComponent component ) throws LexRepositoryException
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
beginTransaction();
|
||||
getSession().refresh( component );
|
||||
endTransaction( true );
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception LexRepositoryException Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void cleanup() throws LexRepositoryException
|
||||
{
|
||||
try
|
||||
{
|
||||
endTransaction( false );
|
||||
HibernateSessionTEMP.closeSession();
|
||||
}
|
||||
catch ( HibernateException he )
|
||||
{
|
||||
throw new LexRepositoryException( he );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/join term collections
|
||||
+ " join term.pronunciations as pron "
|
||||
+ " join term.etymologies as ety "
|
||||
+ " join term.spellings as sp "
|
||||
+ " join term.functions as func "
|
||||
+ " join term.encyclopediaArticles as ency "
|
||||
+ " join term.transitionalData as trans "
|
||||
+ " join term.definitions as def "
|
||||
+ " join term.glosses as glo "
|
||||
+ " join term.keywords as key "
|
||||
+ " join term.translationEquivalents as trans "
|
||||
+ " join term.relatedTerms as rel "
|
||||
+ " join term.passages as pass "
|
||||
+ " join term.registers as reg "
|
||||
join def collections
|
||||
+ " join def.subdefinitions as sub "
|
||||
+ " join def.glosses as gloDef "
|
||||
+ " join def.keywords as keyDef "
|
||||
+ " join def.modelSentences as modDef "
|
||||
+ " join def.translationEquivalents as transDef "
|
||||
+ " join def.relatedTerms as relDef "
|
||||
+ " join def.passages as passDef "
|
||||
+ " join def.registers as regDef "
|
||||
join subdef collections
|
||||
+ " join sub.glosses as gloSub "
|
||||
+ " join sub.keywords as keySub "
|
||||
+ " join sub.modelSentences as modSub "
|
||||
+ " join sub.translationEquivalents as transSub "
|
||||
+ " join sub.relatedTerms as relSub "
|
||||
+ " join sub.passages as passSub "
|
||||
+ " join sub.registers as regSub "
|
||||
join translation collections
|
||||
+ " join ety.translations as etyTrans "
|
||||
+ " join term.definitions.translations as defTrans "
|
||||
+ " join term.modelSentences.translations as modTrans "
|
||||
+ " join term.passages.translations as passTrans "
|
||||
+ " join def.subdefinition.translations as subTrans "
|
||||
+ " join def.modelSentences.translations as modDefTrans "
|
||||
+ " join def.passages.translations as passDefTrans "
|
||||
+ " join sub.modelSentences.translations as modSubTrans "
|
||||
+ " join sub.passages.translations as passSubTrans "
|
||||
/restrict by projectSubject in createdByProjSub
|
||||
+ " where term.meta.createdByProjSub = :projSub"
|
||||
+ " or pron.meta.createdByProjSub = :projSub"
|
||||
+ " or ety.meta.createdByProjSub = :projSub"
|
||||
+ " or sp.meta.createdByProjSub = :projSub"
|
||||
+ " or func.meta.createdByProjSub = :projSub"
|
||||
+ " or ency.meta.createdByProjSub = :projSub"
|
||||
+ " or trans.meta.createdByProjSub = :projSub"
|
||||
+ " or def.meta.createdByProjSub = :projSub"
|
||||
+ " or glo.meta.createdByProjSub = :projSub"
|
||||
+ " or key.meta.createdByProjSub = :projSub"
|
||||
+ " or trans.meta.createdByProjSub = :projSub"
|
||||
+ " or rel.meta.createdByProjSub = :projSub"
|
||||
+ " or pass.meta.createdByProjSub = :projSub"
|
||||
+ " or reg.meta.createdByProjSub = :projSub"
|
||||
+ " or subDef.meta.createdByProjSub = :projSub"
|
||||
+ " or gloDef.meta.createdByProjSub = :projSub"
|
||||
+ " or keyDef.meta.createdByProjSub = :projSub"
|
||||
+ " or modDef.meta.createdByProjSub = :projSub"
|
||||
+ " or transDef.meta.createdByProjSub = :projSub"
|
||||
+ " or relDef.meta.createdByProjSub = :projSub"
|
||||
+ " or passDef.meta.createdByProjSub = :projSub"
|
||||
+ " or regDef.meta.createdByProjSub = :projSub"
|
||||
+ " or gloSub.meta.createdByProjSub = :projSub"
|
||||
+ " or keySub.meta.createdByProjSub = :projSub"
|
||||
+ " or modSub.meta.createdByProjSub = :projSub"
|
||||
+ " or transSub.meta.createdByProjSub = :projSub"
|
||||
+ " or relSub.meta.createdByProjSub = :projSub"
|
||||
+ " or passSub.meta.createdByProjSub = :projSub"
|
||||
+ " or regSub.meta.createdByProjSub = :projSub"
|
||||
+ " or etyTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or defTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or modTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or passTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or subTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or modDefTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or passDefTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or modSubTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or passSubTrans.meta.createdByProjSub = :projSub"
|
||||
/restrict by projectSubject in modifiedByProjSub
|
||||
+ " or term.meta.modifiedByProjSub = :projSub"
|
||||
+ " or pron.meta.modifiedByProjSub = :projSub"
|
||||
+ " or ety.meta.modifiedByProjSub = :projSub"
|
||||
+ " or sp.meta.modifiedByProjSub = :projSub"
|
||||
+ " or func.meta.modifiedByProjSub = :projSub"
|
||||
+ " or ency.meta.modifiedByProjSub = :projSub"
|
||||
+ " or trans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or def.meta.modifiedByProjSub = :projSub"
|
||||
+ " or glo.meta.modifiedByProjSub = :projSub"
|
||||
+ " or key.meta.modifiedByProjSub = :projSub"
|
||||
+ " or trans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or rel.meta.modifiedByProjSub = :projSub"
|
||||
+ " or pass.meta.modifiedByProjSub = :projSub"
|
||||
+ " or reg.meta.modifiedByProjSub = :projSub"
|
||||
+ " or subDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or gloDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or keyDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or transDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or relDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or regDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or gloSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or keySub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or transSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or relSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or regSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or etyTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or defTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or subTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modDefTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passDefTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modSubTrans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passSubTrans.meta.modifiedByProjSub = :projSub";
|
||||
*/
|
||||
|
|
@ -0,0 +1 @@
|
|||
# Default localized resources for DictionaryImporter
dictionaryimporter.driverclassname=org.gjt.mm.mysql.Driver
dictionaryimporter.url=jdbc:mysql://localhost:3306/lex?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&user=USERNAME&password=PASSWORD
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
|
||||
|
||||
<hibernate-configuration>
|
||||
|
||||
<session-factory>
|
||||
|
||||
<!-- TEST CONFIG -->
|
||||
|
||||
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
|
||||
<property name="connection.url">jdbc:mysql://localhost/LexNew</property>
|
||||
<property name="connection.username">USER_XYZ</property>
|
||||
<property name="connection.password">PASS_XYZ</property>
|
||||
<property name="connection.useUnicode">true</property>
|
||||
<property name="connection.characterEncoding">utf-8</property>
|
||||
|
||||
|
||||
|
||||
<!--PRODUCTION CONFIG-->
|
||||
|
||||
<!-- <property name="connection.datasource">java:comp/env/jdbc/lex-datasource</property> -->
|
||||
<property name="show_sql">false</property>
|
||||
<property name="use_outer_join">true</property>
|
||||
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
|
||||
<!-- <property name="max_fetch_depth">15</property>
|
||||
-->
|
||||
<!-- Mapping files -->
|
||||
<mapping resource="org/thdl/lex/util/LexComponentDataTransfer.hbm.xml"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <mapping resource="org/thdl/lex/component/child/Author.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Dialect.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/EtymologyType.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Function.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/FunctionsGeneral.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/FunctionsSpecific.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Language.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/LiteraryForm.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/LiteraryGenre.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/LiteraryPeriod.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/LiterarySource.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/MajorDialectFamily.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/PhoneticsType.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/ProjectSubject.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Register.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/RelatedTermType.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Script.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Source.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/SpecificDialect.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/SpellingType.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/TransitionalDataLabel.hbm.xml"/> -->
|
||||
</session-factory>
|
||||
|
||||
</hibernate-configuration>
|
Loading…
Reference in a new issue