- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Maven
、Spring
、Hibernate
和 rest API
制作应用程序。以下是我的项目的层次结构。持久性模块已编译并可供业务模块使用,并且该业务模块可供端点模块使用。非常简单。
我使用 spring 注释
而不是 xml,这是我试图实现的流程。
基于Web的应用程序调用rest API,在API中调用一个函数,在该函数中调用businessLogic模块,并且在该函数中module 调用持久性模块,其中编写了所有 DAO 及其实现。 每个模块都有自己的配置文件。也非常简单。
根据我所了解到的,我们使用标签@EnableTransactionManagement
来让@Transaction
工作。@Transaction
标签可以用在函数上,并且该函数将被视为单个事务,无论其中调用了多少次插入、更新.
问题:问题很简单,当我启动 apache 时,甚至当我调用稍后调用持久性来保存对象的 API 时,我都没有遇到任何异常。没有数据插入数据库,日志文件中也没有打印异常。
记住层次结构,以下是项目中使用的文件。
EndpointConfiguration.java
@Configuration
@EnableTransactionManagement
@PropertySource(value = { "classpath:persistence-hibernate.properties" })
public class EndpointConfiguration{
@Autowired
public org.springframework.core.env.Environment environment;
@Bean(name = "sessionFactory")
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
sessionFactory.setPackagesToScan(new String[] { "com.product.persistence" });
sessionFactory.setHibernateProperties(hibernateProperties());
return sessionFactory;
}
@Bean(name = "dataSource")
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(environment.getRequiredProperty("jdbc.driverClassName"));
dataSource.setUrl(environment.getRequiredProperty("jdbc.url"));
dataSource.setUsername(environment.getRequiredProperty("jdbc.username"));
dataSource.setPassword(environment.getRequiredProperty("jdbc.password"));
return dataSource;
}
private Properties hibernateProperties() {
Properties properties = new Properties();
properties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect"));
properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));
return properties;
}
@Bean(name = "transactionManager")
public PlatformTransactionManager transactionManager() {
return new DataSourceTransactionManager(dataSource());
}
@Bean(name = "stakeHoldersBusinessLogic")
public IStakeHoldersBusinessLogic stakeHoldersBusinessLogic(){return new StakeHoldersBusinessLogicImpl(); }
@Bean(name = "daoFactoryCustom")
public DaoFactoryCustom daoFactoryCustom(){return new DaoFactoryCustomHbnImpl(); }
// some more beans
}
StakeHoldersEndpointImplRestController.java
@CrossOrigin(origins = "http://localhost:9090")
@RequestMapping(value = "/stakeHolders")
@RestController
public class StakeHoldersEndpointImplRestController implements IStakeHoldersEndpoint, InitializingBean {
@ResponseBody
@RequestMapping(value = "/createStakeHolder",
method = RequestMethod.POST,
headers = "Accept="+ MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public CreateStakeHolderResponse createStakeHolderEndpoint(@RequestBody CreateStakeHolderRequest request) {
LOG.trace("StakeHoldersEndpointImplRestController.createStakeHolder () - Start");
CreateStakeHolderResponse createStakeHolderResponse = new CreateStakeHolderResponse();
try{
createStakeHolderResponse = innerFunction(request);
}catch(Exception exception){
LOG.error("Exception Occurred : "+exception.getMessage());
}
LOG.trace("StakeHoldersEndpointImplRestController.createStakeHolder () - End");
return createStakeHolderResponse;
}
@Transactional
private CreateStakeHolderResponse innerFunction(CreateStakeHolderRequest request){
CreateStakeHolderResponse createStakeHolderResponse = new CreateStakeHolderResponse();
try {
createStakeHolderResponse = stakeHoldersBusinessLogic.createStakeHolderBusinessLogic(request);
}catch (Exception e){
LOG.error("Exception : ",e);
}
return createStakeHolderResponse;
}
BusinessLogicConfiguration.java
@Configuration
@EnableTransactionManagement
public class BusinessLogicConfiguration {
// some beans
}
StakeHoldersBusinessLogicImpl.java
public class StakeHoldersBusinessLogicImpl implements IStakeHoldersBusinessLogic, InitializingBean {
public CreateStakeHolderResponse createStakeHolderBusinessLogic(CreateStakeHolderRequest request) {
LOG.trace("StakeHoldersBusinessLogicImpl.createStakeHolderBusinessLogic () - Start");
CreateStakeHolderResponse createStakeHolderResponse = new CreateStakeHolderResponse(
IConstants.ERROR_CODE_BUSINESS_LOGIC_INITIATED_CODE , IConstants.ERROR_CODE_BUSINESS_LOGIC_INITIATED_STRING);
try{
//some logic to convert the request into stakeHolders, which is a Model bean mapped to a table
daoFactoryCustom.getStakeHoldersDAO().save(stakeHolders, 100L);
}catch(Exception exception){
LOG.error("Exception Occurred : ", exception);
}
LOG.trace("StakeHoldersBusinessLogicImpl.createStakeHolderBusinessLogic () - End");
return createStakeHolderResponse;
}
}
PersistenceConfiguration.java
@Configuration
@EnableTransactionManagement
public class PersistenceConfiguration {
// some beans
}
StakeHoldersDAOImpl.java
@Autowired(required = true)
SessionFactory sessionFactory;
public void save(T obj, Long creator) {
try{
getSession().save(obj);
}catch (Exception e){
LOG.error("Exception : ",e);
}
}
public final Session getSession() {
Session session;
try{
session = getSessionFactory().getCurrentSession();
}catch (HibernateException e){
session = sessionFactory.openSession();
}
return session;
}
我已经研究了一个多星期了,但找不到为什么会发生这种情况。此调用的日志跟踪如下。
18:09:14.653 [http-nio-8080-exec-2] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor : 193 - Read [class com.product.contract.requests.CreateStakeHolderRequest] as "application/json" with [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@30b367c7]
18:09:14.719 [http-nio-8080-exec-2] TRACE org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod : 134 - Invoking [StakeHoldersEndpointImplRestController.createStakeHolderEndpoint] method with arguments [com.product.contract.requests.CreateStakeHolderRequest@17b06234]
18:09:14.719 [http-nio-8080-exec-2] TRACE com.product.endpoint.controller.impl.StakeHoldersEndpointImplRestController : 47 - StakeHoldersEndpointImplRestController.createStakeHolder () - Start
18:09:14.720 [http-nio-8080-exec-2] TRACE com.product.businesslogic.impl.StakeHoldersBusinessLogicImpl : 100 - StakeHoldersBusinessLogicImpl.createStakeHolderBusinessLogic () - Start
18:09:14.743 [http-nio-8080-exec-2] TRACE org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl : 1201 - Opening Hibernate Session. tenant=null, owner=null
18:09:14.912 [http-nio-8080-exec-2] TRACE org.hibernate.service.internal.AbstractServiceRegistryImpl : 229 - Initializing service [role=org.hibernate.stat.spi.StatisticsImplementor]
18:09:14.921 [http-nio-8080-exec-2] DEBUG org.hibernate.stat.internal.StatisticsInitiator : 82 - Statistics initialized [enabled=false]
18:09:14.934 [http-nio-8080-exec-2] TRACE org.hibernate.internal.SessionImpl : 281 - Opened Session [e4202ec0-7fd9-4333-9db4-efefa24d7c53] at timestamp: 14952857548
18:09:14.938 [http-nio-8080-exec-2] TRACE org.hibernate.event.internal.DefaultSaveOrUpdateEventListener : 163 - Saving transient instance
18:09:14.949 [http-nio-8080-exec-2] DEBUG org.hibernate.SQL : 92 -
select
nextval ('pro5.entity_large')
18:09:14.950 [http-nio-8080-exec-2] DEBUG org.springframework.jdbc.datasource.DriverManagerDataSource : 142 - Creating new JDBC DriverManager Connection to [jdbc:postgresql://localhost:5432/postgres]
18:09:14.980 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 55 - Registering statement [select nextval ('pro5.entity_large')]
18:09:15.086 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 182 - Registering result set [org.postgresql.jdbc4.Jdbc4ResultSet@1d32dd3f]
18:09:15.092 [http-nio-8080-exec-2] DEBUG org.hibernate.id.enhanced.SequenceStructure : 101 - Sequence value obtained: 500046
18:09:15.093 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 91 - Releasing result set [org.postgresql.jdbc4.Jdbc4ResultSet@1d32dd3f]
18:09:15.093 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 132 - Closing result set [org.postgresql.jdbc4.Jdbc4ResultSet@1d32dd3f]
18:09:15.093 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 68 - Releasing statement [select nextval ('pro5.entity_large')]
18:09:15.093 [http-nio-8080-exec-2] DEBUG org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 73 - HHH000387: ResultSet's statement was not registered
18:09:15.093 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 148 - Closing prepared statement [select nextval ('pro5.entity_large')]
18:09:15.094 [http-nio-8080-exec-2] TRACE org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl : 263 - Starting afterQuery statement execution processing [AFTER_TRANSACTION]
18:09:15.095 [http-nio-8080-exec-2] DEBUG org.hibernate.event.internal.AbstractSaveEventListener : 118 - Generated identifier: 500046, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
18:09:15.096 [http-nio-8080-exec-2] TRACE org.hibernate.event.internal.AbstractSaveEventListener : 157 - Saving [com.product.persistence.model.StakeHolders#500046]
18:09:15.116 [http-nio-8080-exec-2] TRACE org.hibernate.engine.spi.ActionQueue : 244 - Adding an EntityInsertAction for [com.product.persistence.model.StakeHolders] object
18:09:15.120 [http-nio-8080-exec-2] TRACE org.hibernate.engine.spi.IdentifierValue : 98 - ID unsaved-value strategy UNDEFINED
18:09:15.121 [http-nio-8080-exec-2] TRACE org.hibernate.persister.entity.AbstractEntityPersister : 1338 - Getting current persistent state for: [com.product.persistence.model.keyValuePair.CancellationReason#0]
18:09:15.122 [http-nio-8080-exec-2] DEBUG org.hibernate.SQL : 92 -
select
cancellati_.id_cancellation,
cancellati_.dat_last_update as dat_last4_1_,
cancellati_.id_customer_last_update as id_custo5_1_,
cancellati_.str_cancellation_reason as str_canc6_1_
from
pro5.cancellation_reason cancellati_
where
cancellati_.id_cancellation=?
18:09:15.123 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 55 - Registering statement [select cancellati_.id_cancellation, cancellati_.dat_last_update as dat_last4_1_, cancellati_.id_customer_last_update as id_custo5_1_, cancellati_.str_cancellation_reason as str_canc6_1_ from pro5.cancellation_reason cancellati_ where cancellati_.id_cancellation=?]
18:09:15.127 [http-nio-8080-exec-2] TRACE org.hibernate.type.descriptor.sql.BasicBinder : 65 - binding parameter [1] as [INTEGER] - [0]
18:09:15.168 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 182 - Registering result set [org.postgresql.jdbc4.Jdbc4ResultSet@1f3e3b2c]
18:09:15.171 [http-nio-8080-exec-2] TRACE org.hibernate.type.descriptor.sql.BasicExtractor : 51 - extracted value ([dat_last4_1_] : [TIMESTAMP]) - [null]
18:09:15.172 [http-nio-8080-exec-2] TRACE org.hibernate.type.descriptor.sql.BasicExtractor : 51 - extracted value ([id_custo5_1_] : [BIGINT]) - [null]
18:09:15.174 [http-nio-8080-exec-2] TRACE org.hibernate.type.descriptor.sql.BasicExtractor : 61 - extracted value ([str_canc6_1_] : [VARCHAR]) - [Fraud]
18:09:15.175 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 91 - Releasing result set [org.postgresql.jdbc4.Jdbc4ResultSet@1f3e3b2c]
18:09:15.175 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 132 - Closing result set [org.postgresql.jdbc4.Jdbc4ResultSet@1f3e3b2c]
18:09:15.175 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 68 - Releasing statement [select cancellati_.id_cancellation, cancellati_.dat_last_update as dat_last4_1_, cancellati_.id_customer_last_update as id_custo5_1_, cancellati_.str_cancellation_reason as str_canc6_1_ from pro5.cancellation_reason cancellati_ where cancellati_.id_cancellation=0]
18:09:15.176 [http-nio-8080-exec-2] DEBUG org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 73 - HHH000387: ResultSet's statement was not registered
18:09:15.176 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 148 - Closing prepared statement [select cancellati_.id_cancellation, cancellati_.dat_last_update as dat_last4_1_, cancellati_.id_customer_last_update as id_custo5_1_, cancellati_.str_cancellation_reason as str_canc6_1_ from pro5.cancellation_reason cancellati_ where cancellati_.id_cancellation=0]
18:09:15.176 [http-nio-8080-exec-2] TRACE org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl : 263 - Starting afterQuery statement execution processing [AFTER_TRANSACTION]
18:09:15.177 [http-nio-8080-exec-2] TRACE org.hibernate.engine.spi.IdentifierValue : 98 - ID unsaved-value strategy UNDEFINED
18:09:15.177 [http-nio-8080-exec-2] TRACE org.hibernate.persister.entity.AbstractEntityPersister : 1338 - Getting current persistent state for: [com.product.persistence.model.keyValuePair.Cities#0]
18:09:15.178 [http-nio-8080-exec-2] DEBUG org.hibernate.SQL : 92 -
select
cities_.id_city,
cities_.dat_last_update as dat_last4_2_,
cities_.id_customer_last_update as id_custo5_2_,
cities_.str_city as str_city6_2_
from
pro5.cities cities_
where
cities_.id_city=?
18:09:15.178 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 55 - Registering statement [select cities_.id_city, cities_.dat_last_update as dat_last4_2_, cities_.id_customer_last_update as id_custo5_2_, cities_.str_city as str_city6_2_ from pro5.cities cities_ where cities_.id_city=?]
18:09:15.179 [http-nio-8080-exec-2] TRACE org.hibernate.type.descriptor.sql.BasicBinder : 65 - binding parameter [1] as [BIGINT] - [0]
18:09:15.199 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 182 - Registering result set [org.postgresql.jdbc4.Jdbc4ResultSet@7b2493e9]
18:09:15.200 [http-nio-8080-exec-2] TRACE org.hibernate.type.descriptor.sql.BasicExtractor : 51 - extracted value ([dat_last4_2_] : [TIMESTAMP]) - [null]
18:09:15.200 [http-nio-8080-exec-2] TRACE org.hibernate.type.descriptor.sql.BasicExtractor : 51 - extracted value ([id_custo5_2_] : [BIGINT]) - [null]
18:09:15.201 [http-nio-8080-exec-2] TRACE org.hibernate.type.descriptor.sql.BasicExtractor : 61 - extracted value ([str_city6_2_] : [VARCHAR]) - [Lahore]
18:09:15.201 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 91 - Releasing result set [org.postgresql.jdbc4.Jdbc4ResultSet@7b2493e9]
18:09:15.201 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 132 - Closing result set [org.postgresql.jdbc4.Jdbc4ResultSet@7b2493e9]
18:09:15.202 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 68 - Releasing statement [select cities_.id_city, cities_.dat_last_update as dat_last4_2_, cities_.id_customer_last_update as id_custo5_2_, cities_.str_city as str_city6_2_ from pro5.cities cities_ where cities_.id_city=0]
18:09:15.202 [http-nio-8080-exec-2] DEBUG org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 73 - HHH000387: ResultSet's statement was not registered
18:09:15.202 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 148 - Closing prepared statement [select cities_.id_city, cities_.dat_last_update as dat_last4_2_, cities_.id_customer_last_update as id_custo5_2_, cities_.str_city as str_city6_2_ from pro5.cities cities_ where cities_.id_city=0]
18:09:15.202 [http-nio-8080-exec-2] TRACE org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl : 263 - Starting afterQuery statement execution processing [AFTER_TRANSACTION]
18:09:15.203 [http-nio-8080-exec-2] TRACE org.hibernate.engine.spi.IdentifierValue : 98 - ID unsaved-value strategy UNDEFINED
18:09:15.203 [http-nio-8080-exec-2] TRACE org.hibernate.persister.entity.AbstractEntityPersister : 1338 - Getting current persistent state for: [com.product.persistence.model.StakeHoldersType#10]
18:09:15.203 [http-nio-8080-exec-2] DEBUG org.hibernate.SQL : 92 -
select
stakeholde_.id_stake_holder_type,
stakeholde_.id_str_role as id_str_r3_25_,
stakeholde_.str_stake_holder_desc as str_stak2_25_
from
pro5.stake_holders_type stakeholde_
where
stakeholde_.id_stake_holder_type=?
18:09:15.204 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 55 - Registering statement [select stakeholde_.id_stake_holder_type, stakeholde_.id_str_role as id_str_r3_25_, stakeholde_.str_stake_holder_desc as str_stak2_25_ from pro5.stake_holders_type stakeholde_ where stakeholde_.id_stake_holder_type=?]
18:09:15.205 [http-nio-8080-exec-2] TRACE org.hibernate.type.descriptor.sql.BasicBinder : 65 - binding parameter [1] as [BIGINT] - [10]
18:09:15.208 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 182 - Registering result set [org.postgresql.jdbc4.Jdbc4ResultSet@3c215e9d]
18:09:15.209 [http-nio-8080-exec-2] TRACE org.hibernate.type.descriptor.sql.BasicExtractor : 51 - extracted value ([id_str_r3_25_] : [VARCHAR]) - [null]
18:09:15.210 [http-nio-8080-exec-2] TRACE org.hibernate.type.descriptor.sql.BasicExtractor : 61 - extracted value ([str_stak2_25_] : [VARCHAR]) - [Transport]
18:09:15.210 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 91 - Releasing result set [org.postgresql.jdbc4.Jdbc4ResultSet@3c215e9d]
18:09:15.210 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 132 - Closing result set [org.postgresql.jdbc4.Jdbc4ResultSet@3c215e9d]
18:09:15.211 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 68 - Releasing statement [select stakeholde_.id_stake_holder_type, stakeholde_.id_str_role as id_str_r3_25_, stakeholde_.str_stake_holder_desc as str_stak2_25_ from pro5.stake_holders_type stakeholde_ where stakeholde_.id_stake_holder_type=10]
18:09:15.212 [http-nio-8080-exec-2] DEBUG org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 73 - HHH000387: ResultSet's statement was not registered
18:09:15.212 [http-nio-8080-exec-2] TRACE org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl : 148 - Closing prepared statement [select stakeholde_.id_stake_holder_type, stakeholde_.id_str_role as id_str_r3_25_, stakeholde_.str_stake_holder_desc as str_stak2_25_ from pro5.stake_holders_type stakeholde_ where stakeholde_.id_stake_holder_type=10]
18:09:15.212 [http-nio-8080-exec-2] TRACE org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl : 263 - Starting afterQuery statement execution processing [AFTER_TRANSACTION]
18:09:15.213 [http-nio-8080-exec-2] TRACE org.hibernate.engine.spi.ActionQueue : 257 - Adding insert with no non-nullable, transient entities: [EntityInsertAction[com.product.persistence.model.StakeHolders#500046]]
18:09:15.213 [http-nio-8080-exec-2] TRACE org.hibernate.engine.spi.ActionQueue : 280 - Adding resolved non-early insert action.
18:09:15.216 [http-nio-8080-exec-2] TRACE org.hibernate.engine.spi.IdentifierValue : 98 - ID unsaved-value strategy UNDEFINED
18:09:15.216 [http-nio-8080-exec-2] TRACE org.hibernate.engine.spi.IdentifierValue : 98 - ID unsaved-value strategy UNDEFINED
18:09:15.216 [http-nio-8080-exec-2] TRACE org.hibernate.engine.spi.IdentifierValue : 98 - ID unsaved-value strategy UNDEFINED
18:09:15.225 [http-nio-8080-exec-2] TRACE com.product.businesslogic.impl.StakeHoldersBusinessLogicImpl : 152 - StakeHoldersBusinessLogicImpl.createStakeHolderBusinessLogic () - End
18:09:15.225 [http-nio-8080-exec-2] TRACE com.product.endpoint.controller.impl.StakeHoldersEndpointImplRestController : 82 - StakeHoldersEndpointImplRestController.createStakeHolder () - End
18:09:15.226 [http-nio-8080-exec-2] TRACE org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod : 138 - Method [createStakeHolderEndpoint] returned [com.product.contract.responses.CreateStakeHolderResponse@6aac8e42]
18:09:15.301 [http-nio-8080-exec-2] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor : 226 - Written [com.product.contract.responses.CreateStakeHolderResponse@6aac8e42] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@30b367c7]
18:09:15.302 [http-nio-8080-exec-2] DEBUG org.springframework.web.servlet.DispatcherServlet : 1036 - Null ModelAndView returned to DispatcherServlet with name 'dispatcher': assuming HandlerAdapter completed request handling
18:09:15.302 [http-nio-8080-exec-2] TRACE org.springframework.web.servlet.DispatcherServlet : 1059 - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@70e62c16
18:09:15.302 [http-nio-8080-exec-2] DEBUG org.springframework.web.servlet.DispatcherServlet : 997 - Successfully completed request
18:09:15.302 [http-nio-8080-exec-2] TRACE org.springframework.web.context.support.AnnotationConfigWebApplicationContext : 363 - Publishing event in WebApplicationContext for namespace 'dispatcher-servlet': ServletRequestHandledEvent: url=[/endpoint/stakeHolders/createStakeHolder]; client=[0:0:0:0:0:0:0:1]; method=[POST]; servlet=[dispatcher]; session=[null]; user=[null]; time=[807ms]; status=[OK]
18:09:15.302 [http-nio-8080-exec-2] TRACE org.springframework.web.context.support.AnnotationConfigWebApplicationContext : 363 - Publishing event in Root WebApplicationContext: ServletRequestHandledEvent: url=[/endpoint/stakeHolders/createStakeHolder]; client=[0:0:0:0:0:0:0:1]; method=[POST]; servlet=[dispatcher]; session=[null]; user=[null]; time=[807ms]; status=[OK]
我在这一切中做错了什么,任何帮助都会很棒。
谢谢
伊沙德·艾哈迈德。
最佳答案
首先,@Transactional
不适用于代理模式(默认)下的私有(private)方法。
其次,使用 @Transactional 注释 Controller 方法有点不寻常。通常您用它来注释服务类(如果您只有 DAO 而没有服务,则使用 DAO 类)。
所以我建议如下:
@Transactional
注释 StakeHoldersBusinessLogicImpl
(因为这似乎是您的服务)@Transactional
关于java - @EnableTransactionManagement 和 @Transaction 不适用于 Hibernate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44087481/
我正在编写一个具有以下签名的 Java 方法。 void Logger(Method method, Object[] args); 如果一个方法(例如 ABC() )调用此方法 Logger,它应该
我是 Java 新手。 我的问题是我的 Java 程序找不到我试图用作的图像文件一个 JButton。 (目前这段代码什么也没做,因为我只是得到了想要的外观第一的)。这是我的主课 代码: packag
好的,今天我在接受采访,我已经编写 Java 代码多年了。采访中说“Java 垃圾收集是一个棘手的问题,我有几个 friend 一直在努力弄清楚。你在这方面做得怎么样?”。她是想骗我吗?还是我的一生都
我的 friend 给了我一个谜语让我解开。它是这样的: There are 100 people. Each one of them, in his turn, does the following
如果我将使用 Java 5 代码的应用程序编译成字节码,生成的 .class 文件是否能够在 Java 1.4 下运行? 如果后者可以工作并且我正在尝试在我的 Java 1.4 应用程序中使用 Jav
有关于why Java doesn't support unsigned types的问题以及一些关于处理无符号类型的问题。我做了一些搜索,似乎 Scala 也不支持无符号数据类型。限制是Java和S
我只是想知道在一个 java 版本中生成的字节码是否可以在其他 java 版本上运行 最佳答案 通常,字节码无需修改即可在 较新 版本的 Java 上运行。它不会在旧版本上运行,除非您使用特殊参数 (
我有一个关于在命令提示符下执行 java 程序的基本问题。 在某些机器上我们需要指定 -cp 。 (类路径)同时执行java程序 (test为java文件名与.class文件存在于同一目录下) jav
我已经阅读 StackOverflow 有一段时间了,现在我才鼓起勇气提出问题。我今年 20 岁,目前在我的家乡(罗马尼亚克卢日-纳波卡)就读 IT 大学。足以介绍:D。 基本上,我有一家提供簿记应用
我有 public JSONObject parseXML(String xml) { JSONObject jsonObject = XML.toJSONObject(xml); r
我已经在 Java 中实现了带有动态类型的简单解释语言。不幸的是我遇到了以下问题。测试时如下代码: def main() { def ks = Map[[1, 2]].keySet()
一直提示输入 1 到 10 的数字 - 结果应将 st、rd、th 和 nd 添加到数字中。编写一个程序,提示用户输入 1 到 10 之间的任意整数,然后以序数形式显示该整数并附加后缀。 public
我有这个 DownloadFile.java 并按预期下载该文件: import java.io.*; import java.net.URL; public class DownloadFile {
我想在 GUI 上添加延迟。我放置了 2 个 for 循环,然后重新绘制了一个标签,但这 2 个 for 循环一个接一个地执行,并且标签被重新绘制到最后一个。 我能做什么? for(int i=0;
我正在对对象 Student 的列表项进行一些测试,但是我更喜欢在 java 类对象中创建硬编码列表,然后从那里提取数据,而不是连接到数据库并在结果集中选择记录。然而,自从我这样做以来已经很长时间了,
我知道对象创建分为三个部分: 声明 实例化 初始化 classA{} classB extends classA{} classA obj = new classB(1,1); 实例化 它必须使用
我有兴趣使用 GPRS 构建车辆跟踪系统。但是,我有一些问题要问以前做过此操作的人: GPRS 是最好的技术吗?人们意识到任何问题吗? 我计划使用 Java/Java EE - 有更好的技术吗? 如果
我可以通过递归方法反转数组,例如:数组={1,2,3,4,5} 数组结果={5,4,3,2,1}但我的结果是相同的数组,我不知道为什么,请帮助我。 public class Recursion { p
有这样的标准方式吗? 包括 Java源代码-测试代码- Ant 或 Maven联合单元持续集成(可能是巡航控制)ClearCase 版本控制工具部署到应用服务器 最后我希望有一个自动构建和集成环境。
我什至不知道这是否可能,我非常怀疑它是否可能,但如果可以,您能告诉我怎么做吗?我只是想知道如何从打印机打印一些文本。 有什么想法吗? 最佳答案 这里有更简单的事情。 import javax.swin
我是一名优秀的程序员,十分优秀!