sql
task. a JDBC driver for your database
Note that hloader's typical use is as a tool at development time, so it's dependencies do not affect the runtime software's dependencies. Most of the depdendencies are also Hibernate dependencies, with the exception of jelly and jexl which will be additional.
SimpleLog
. This enables
ehcache to use logging infrastructures compatible with Java versions
from JDK1.2 to JDK5. It does create a dependency on Apache Commons
Logging, however many projects, including Hibernate, share the same
dependency.net.sf.hloader
.<?xml
version="1.0"?> <!DOCTYPE project [ <!ENTITY bootstrap SYSTEM "bootstrap.xml"> ]> <j:jelly trim="false" xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:h="jelly:net.sf.hloader.jelly.HloaderTagLibrary"> <h:loadobjects configuration="/hibernate.cfg.xml"> <hloader package="com.lggi.sp.common.spatial.core"> <converters> <converter class='java.util.Date' name='net.sf.hloader.converter.DateConverter'/> </converters> <loader dialect='org.hibernate.dialect.MySQLDialect' nextIdentity='set insert_id = {0};'/> <loader dialect='org.hibernate.dialect.SqlServerDialect' identityGenerationDisableString='set identity_insert {0} on;' identityGenerationEnableString='set identity_insert {0} off;'/> <loader dialect='org.hibernate.dialect.Oracle9Dialect' resetNextIdentityGeneratedValueString='alter sequence = {0};'/> <loader dialect='org.hibernate.dialect.HSQLDialect'/> <j:new var="dateUtil" className="net.sf.hloader.util.DateUtil"/> <j:set var="now" value="${dateUtil.time}"/> <j:set var="today" value="${dateUtil.startOfDay}"/> <j:set var="DAY" value="86400000"/> <j:set var="yesterday" value="${dateUtil.addDays(-1)}"/> <j:set var="tomorrow" value="${dateUtil.addDays(1)}"/> <defaults> <!-- Add default values for objects here --> </defaults> <objects> <!-- Add objects here--> </objects> </hloader> </h:loadobjects> </j:jelly> |
<?xml version='1.0' encoding='utf-8'?> <!ELEMENT hloader (converters|loaderdialects|defaults|objects)*> <!ATTLIST hloader package CDATA #REQUIRED> <!ELEMENT converters (converter)*> <!ELEMENT converter EMPTY> <!ATTLIST converter name CDATA #REQUIRED class CDATA #REQUIRED> <!ELEMENT loaderdialects (loader)*> <!ELEMENT loader (#PCDATA)> <!ATTLIST loader dialect CDATA #REQUIRED resetNextIdentity CDATA #IMPLIED setNextIdentityGeneratedValueString CDATA #IMPLIED> <!ELEMENT defaults (#PCDATA)> <!ELEMENT objects (#PCDATA)> |
Date
and Timestamp
converter to
allow date calculations resulting in longs to be converted to Date
or Timestamp
objects.<Region registrationAllowed="true" defaultTaxRate=".1" />When an object such as Region is defined here, then the defined attributes will be applied to all objects created in
registrationAllowed will be set to "true"; and
defaultTaxRate will be set to ".1".
To set constant ids for the object RoomFacility:
<Country
displayName="Australia" /> |
<Country> <displayName>Australia</displayName> </Country> |
<?xml version="1.0"?> |
|
ObjectLoader loadObjects = new
ObjectLoader(inputstream, hibernateConfigFile); loadObjects.execute(); |