Friday, April 23, 2010

ParentAppContext

The bk-core.spring is deployed by Spring Deployer and its applicatonContext could be parent context of the webApplicatonContext (loaded by ContextLoaderListener) in bk-config-engine.war to share the beans in bk-core. To configure this:

1. In bk-core's jboss-spring.xml


BeanFactory=(java:/bkCore);

Then the beanFactory will be bound to JNDI in unserialized form with the given name by Spring deployer.

2. In bk-config-engine.war's web.xml


parentContextKey
bkCoreAppContext


3. Add beanRefContext.xml in bk-config-engine.war (located in classpath)

<jee:jndi-lookup id="bkCoreAppContext" jndi-name="java:/bkCore"/>

Thursday, April 8, 2010

Choose XML Parser


System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
System.setProperty("javax.xml.parsers.SAXParserFactory", "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");

Monday, March 15, 2010

Hibernate Native SQL

Hiberante HQL/Criteria doesn't support the query for Map collection with dereferenced key object. AddEntity() method will convert the result into domain object, otherwise, it would be an object array.


String sqlStr = "select t.* from ce_template t, ce_apProfileTemplate_wlanServiceTemplate aw "
+ "where t.id=aw.apProfileTemplateId and t.templateType='APPROFILE' and t.oldId=0 "
+ "and aw.wlanServiceTemplateId=:id";
Query query = getSession().createSQLQuery(sqlStr)
.addEntity("t", Template.class)
.setInteger("id", t.getId());

Sunday, March 7, 2010

烟霞闲骨格,泉石野生涯。

探春秋爽斋内对联