小编Pra*_*kar的帖子

Spring @Transaction没有启动事务

我正在使用Spring 3和Hibernate 3.我正在尝试配置Spring声明式事务,但无论我尝试什么,Spring事务都没有开始.

这是我的配置

文件:applicationContext-hibernate.xml

<tx:annotation-driven transaction-manager="txManager" />

<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<bean id="mdbDataSource" class="org.apache.commons.dbcp.BasicDataSource">
...
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
 <property name="dataSource" ref="mdbDataSource" />
  <property name="annotatedClasses">
.....
</bean>
Run Code Online (Sandbox Code Playgroud)

我有一个ServiceLocatorImpl类,它实现了ServiceLocator接口

@Service("serviceLocator")
@Transactional
public class ServiceLocatorImpl implements  ApplicationContextAware, Serializable, ServletContextAware, ServiceLocator {
public ResultObject executeService( Map objArgs )
{
      if(TransactionSynchronizationManager.isActualTransactionActive()) {
          LOGGER.debug("ServiceLocator:executeService - Active transaction found");
      } else {
        LOGGER.error("No active transaction found");
      }
         ......
}
     ....
}
Run Code Online (Sandbox Code Playgroud)

在我看来,我的所有配置都是正确的.但是,当调用executeService方法时,TransactionSynchronizationManager.isActualTransactionActive()始终返回false.

请帮我解决这个问题.如果需要更多信息,请告诉我.

更新: 我已将ServiceLocator连接到其他类之一,如下所示:

@Autowired
private ServiceLocator serviceLocator; // ServiceLocator …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate transactions transactional

15
推荐指数
1
解决办法
9771
查看次数

如何在dojo中的DateTextBox中突出显示今天的日期

当文本框为空时,有没有办法在dojo DateTextBox中突出显示(显示选定的)当前日期?我不想在文本框中显示日期(它应该保持为空),而只是显示今天的日期为选中状态.

我尝试使用dojo提供的'dropDownDefaultValue'属性,但它不起作用(当前值未显示为选中或突出显示).

我正在使用dojo版本1.7.1.

在这方面的任何建议将是伟大的.

dojo

4
推荐指数
1
解决办法
745
查看次数

无法将插件目标绑定到 Maven 生命周期阶段

我正在使用 maven sql 插件。在执行集成测试之前,我正在使用该插件来设置我的测试数据库。这是我的项目 pom 中的插件配置。当我执行时,mvn clean install我希望插件目标能够执行。但他们没有被处决。任何帮助将不胜感激。我遇到了类似的 aspectj 插件问题(下面提供了配置)。

我的 SQL 插件配置:

<!-- Maven SQL Plugin for setting up test schema for integration tests -->
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>sql-maven-plugin</artifactId>
    <version>1.5</version>
    <dependencies> <!-- specify the dependent JDBC driver here -->
        <dependency>
            <groupId>${jdbc.groupId}</groupId>
            <artifactId>${jdbc.artifactId}</artifactId>
            <version>${jdbc.version}</version>
        </dependency>
    </dependencies>
    <!-- common configuration shared by all executions -->
    <configuration>
        <driver>org.hsqldb.jdbcDriver</driver>
        <url>jdbc:hsqldb:sample</url>
        <username>sa</username>
        <password></password>
    </configuration>

    <executions>
        <execution>
            <id>create_db_schema</id>
            <phase>process-test-resources</phase>
            <goals>
                <goal>execute</goal>
            </goals>
            <!-- specific configuration for this execution -->
            <configuration>
                <srcFiles>
                    <srcFile>src/test/resources/test-schema.sql</srcFile>
                </srcFiles>
            </configuration> …
Run Code Online (Sandbox Code Playgroud)

java aspectj maven aspectj-maven-plugin

2
推荐指数
1
解决办法
1382
查看次数