;
access="property"
column="`${attr.columnName}`"
length="${attr.length}"
not-null="false"
unique="false"
/>
</#if>
</#list>
</#if>
</class>
</hibernate-mapping>
hibernate.cfg.xml
<!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="dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="connection.url">jdbc:jtds:sqlserver://127.0.0.1:1433;databasename=struts;SelectMethod=cursor</property>
<property name="connection.username">sa</property>
<property name="connection.password">sa</property>
<property name="show_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!--
<mapping resource="hibernate/FormAttribute.hbm.xml" />
<mapping resource="hibernate/Form.hbm.xml" />
-->
</session-factory>
</hibernate-configuration>
強蓑燕汽式強蓑秀燕糞?圻尖(3)
扮寂:2011-01-08 blogjava limq
幹秀挫方象垂朔 祥勣旋喘groovy強蓑幹秀恵諒旗鷹阻?枠心霞編旗鷹 壅心醤悶糞??
public void testGroovy() {
Form form = formService.get("1");
List<FormAttribute> list = formAttributeService
.getAttributeListByFormId(form.getId());
form.setFormAttributeList(list);
FormGenerator fg = new FormGenerator(form);
String groovycode = fg.generator();
ClassLoader parent = getClass().getClassLoader();
GroovyClassLoader loader = new GroovyClassLoader(parent);
Class groovyClass = loader.parseClass(groovycode);
GroovyObject groovyObject = null;
try {
groovyObject = (GroovyObject) groovyClass.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
// map嶄key葎formAttribute嶄宙峰乎燕汽忖粁壓方象垂嶄議兆各c_columnName
// 醤悶秤趨功象
|