小编Tom*_*m S的帖子

JMS消息接收器通过JMSCorrelationID过滤

如何在java(JRE/JDK/J2EE 1.4)中实例化JMS队列侦听器,该侦听器仅接收与给定JMSCorrelationID匹配的消息?我想要获取的消息已发布到队列而不是主题,尽管如果需要可以更改.

这是我目前用于将消息放入队列的代码:

/**
 * publishResponseToQueue publishes Requests to the Queue.
 *
 * @param   jmsQueueFactory             -Name of the queue-connection-factory
 * @param   jmsQueue                    -The queue name for the request
 * @param   response                     -A response object that needs to be published
 * 
 * @throws  ServiceLocatorException     -An exception if a request message
 *                                      could not be published to the Topic
 */
private void publishResponseToQueue( String jmsQueueFactory,
                                    String jmsQueue,
                                    Response response )
        throws ServiceLocatorException {

    if ( logger.isInfoEnabled() ) {
        logger.info( "Begin publishRequestToQueue: " …
Run Code Online (Sandbox Code Playgroud)

queue jms java-ee

10
推荐指数
2
解决办法
3万
查看次数

Hibernate条件查询使用关键字段上的Max()投影和外部主键分组

我很难在Hibernate(版本3.2.5)中将此查询(直接在数据库上工作)表示为条件查询:

SELECT s.* 
  FROM ftp_status s 
 WHERE (s.datetime,s.connectionid) IN (SELECT MAX(f.datetime),
                                              f.connectionid 
                                         FROM ftp_status f
                                        GROUP BY f.connectionid);
Run Code Online (Sandbox Code Playgroud)

到目前为止,这是我提出的不起作用,并抛出could not resolve property: datetime of: common.entity.FtpStatus错误信息:

Criteria crit = s.createCriteria(FtpStatus.class);
crit = crit.createAlias("connections", "c");
crit = crit.createAlias("id", "f");
ProjectionList proj = Projections.projectionList();
proj = proj.add(Projections.max("f.datetime"));
proj = proj.add(Projections.groupProperty("c.connectionid"));
crit = crit.setProjection(proj);
List<FtpStatus> dtlList = crit.list();
Run Code Online (Sandbox Code Playgroud)

以下是Netbeans 6.8直接从数据库生成的相关参考配置:

FtpStatus.hbm.xml -

<hibernate-mapping>
   <class name="common.entity.FtpStatus" table="ftp_status" catalog="common">
        <composite-id name="id" class="common.entity.FtpStatusId">
            <key-property name="siteid" type="int">
                <column name="siteid" />
            </key-property>
            <key-property name="connectionid" type="int">
                <column name="connectionid" …
Run Code Online (Sandbox Code Playgroud)

hibernate group-by foreign-keys projection many-to-one

6
推荐指数
1
解决办法
5万
查看次数