Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

23 May, 2008

adding facet management to eclipse project

1. open .project file
2. add to natures tag next line :
org.eclipse.wst.common.project.facet.core.nature

31 December, 2007

Spring->Qiartz->Concurrent job

Using the MethodInvokingJobDetailFactoryBean, you don't need to create one-line jobs that just invoke a method, and you only need to create the actual business object and wire up the detail object.
By default, Quartz Jobs are stateless, resulting in the possibility of jobs interfering with each other. If you specify two triggers for the same JobDetail, it might be possible that before the first job has finished, the second one will start. If JobDetail classes implement the Stateful interface, this won't happen. The second job will not start before the first one has finished. To make jobs resulting from the MethodInvokingJobDetailFactoryBean non-concurrent, set the concurrent flag to false.



<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">

<property name="targetObject" ref="exampleBusinessObject">

<property name="targetMethod" value="doIt">

<property name="concurrent" value="false">

</bean>


оч хороший пример : http://firstpartners.net/kb/index.php/Cron_Timer_functionality_using_Spring_and_Quartz

30 December, 2007

Hibernate find by "Criteria" of member collection

the problem is to get mapped entity by few search criterias where one or more from them related to member types/collection members of this top level element

the aswer is to use "Criteria" and also add criteria to member of top level entity by calling criteria.createCriteria(member object/collection name) :


Criteria cr = getSession().createCriteria(Some_DT.class).setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

cr.add(Restrictions.in(member_name, some_collection));
cr.add(Restrictions.ge(member_name, some_value));
cr.add(Restrictions.le(member_name, some_value));
cr.add(Restrictions.in(member_name, some_collection));

cr.createCriteria(member object/collection name).add(Restrictions.like(child member->member name, "%"+some value+"%"));


неплохой пост описывающий ту же ситуацию : http://lucker.intervelopers.com/java/cc_join/

26 December, 2007

ResourceBundle via JDBC

will be updated shortly