2017-03-26 20:17:840 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Unable to apply any optimisations to advised method: public java.lang.String java.lang.Object.toString()
2017-03-26 20:17:840 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Found 'hashCode' method: public native int java.lang.Object.hashCode()
2017-03-26 20:17:841 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Unable to apply any optimisations to advised method: protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException
2017-03-26 20:17:841 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract int org.springframework.aop.framework.Advised.indexOf(org.springframework.aop.Advisor)
2017-03-26 20:17:841 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract int org.springframework.aop.framework.Advised.indexOf(org.aopalliance.aop.Advice)
2017-03-26 20:17:841 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isFrozen()
2017-03-26 20:17:842 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.setTargetSource(org.springframework.aop.TargetSource)
2017-03-26 20:17:842 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvisor(org.springframework.aop.Advisor) throws org.springframework.aop.framework.AopConfigException
2017-03-26 20:17:842 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvisor(int,org.springframework.aop.Advisor) throws org.springframework.aop.framework.AopConfigException
2017-03-26 20:17:843 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isExposeProxy()
2017-03-26 20:17:843 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract java.lang.Class[] org.springframework.aop.framework.Advised.getProxiedInterfaces()
2017-03-26 20:17:843 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isInterfaceProxied(java.lang.Class)
2017-03-26 20:17:843 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.replaceAdvisor(org.springframework.aop.Advisor,org.springframework.aop.Advisor) throws org.springframework.aop.framework.AopConfigException
2017-03-26 20:17:843 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract java.lang.String org.springframework.aop.framework.Advised.toProxyConfigString()
2017-03-26 20:17:844 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvice(int,org.aopalliance.aop.Advice) throws org.springframework.aop.framework.AopConfigException
2017-03-26 20:17:844 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvice(org.aopalliance.aop.Advice) throws org.springframework.aop.framework.AopConfigException
2017-03-26 20:17:844 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isPreFiltered()
2017-03-26 20:17:844 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract org.springframework.aop.Advisor[] org.springframework.aop.framework.Advised.getAdvisors()
2017-03-26 20:17:844 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.removeAdvisor(int) throws org.springframework.aop.framework.AopConfigException
2017-03-26 20:17:845 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.removeAdvisor(org.springframework.aop.Advisor)
2017-03-26 20:17:845 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.removeAdvice(org.aopalliance.aop.Advice)
2017-03-26 20:17:845 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract org.springframework.aop.TargetSource org.springframework.aop.framework.Advised.getTargetSource()
2017-03-26 20:17:845 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isProxyTargetClass()
2017-03-26 20:17:845 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.setPreFiltered(boolean)
2017-03-26 20:17:846 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.setExposeProxy(boolean)
2017-03-26 20:17:846 | DEBUG | org.springframework.aop.framework.CglibAopProxy.accept() - Method is declared on Advised interface: public abstract java.lang.Class org.springframework.aop.TargetClassAware.getTargetClass()
2017-03-26 20:17:872 | DEBUG | org.springframework.beans.factory.support.DefaultListableBeanFactory.createBean() - Finished creating instance of bean 'userService'
2017-03-26 20:17:877 | DEBUG | org.springframework.beans.factory.support.DefaultListableBeanFactory.getSingleton() - Creating shared instance of singleton bean 'transactionManager'
2017-03-26 20:17:877 | DEBUG | org.springframework.beans.factory.support.DefaultListableBeanFactory.createBean() - Creating instance of bean 'transactionManager'
2017-03-26 20:17:878 | DEBUG | org.springframework.beans.factory.support.DefaultListableBeanFactory.doCreateBean() - Eagerly caching bean 'transactionManager' to allow for resolving potential circular references
2017-03-26 20:17:887 | DEBUG | org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBean() - Returning cached instance of singleton bean 'entityManagerFactory'
2017-03-26 20:17:887 | DEBUG | org.springframework.beans.factory.support.DefaultListableBeanFactory.invokeInitMethods() - Invoking afterPropertiesSet() on bean with name 'transactionManager'
2017-03-26 20:17:889 | DEBUG | org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBean() - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
2017-03-26 20:17:892 | DEBUG | org.springframework.beans.factory.support.DefaultListableBeanFactory.createBean() - Finished creating instance of bean 'transactionManager'
2017-03-26 20:17:897 | DEBUG | org.springframework.orm.jpa.JpaTransactionManager.getTransaction() - Creating new transaction with name [com.longqi.wsshp.service.UserService.save]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
2017-03-26 20:17:971 | DEBUG | org.hibernate.stat.internal.StatisticsInitiator.initiateServiceInternal() - Statistics initialized [enabled=false]
2017-03-26 20:17:975 | DEBUG | org.springframework.orm.jpa.JpaTransactionManager.doBegin() - Opened new EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@4674b826] for JPA transaction
2017-03-26 20:17:978 | DEBUG | org.hibernate.engine.transaction.internal.TransactionImpl.begin() - begin
2017-03-26 20:17:981 | DEBUG | org.springframework.orm.jpa.JpaTransactionManager.doBegin() - Exposing JPA transaction as JDBC transaction [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@1ae3c86b]
2017-03-26 20:17:027 | DEBUG | org.hibernate.SQL.logStatement() - select nextval ('hibernate_sequence')
Hibernate: select nextval ('hibernate_sequence')
2017-03-26 20:17:043 | DEBUG | org.hibernate.id.enhanced.SequenceStructure.getNextValue() - Sequence value obtained: 1
2017-03-26 20:17:044 | DEBUG | org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl.release() - HHH000387: ResultSet's statement was not registered
2017-03-26 20:17:045 | DEBUG | org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId() - Generated identifier: 1, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2017-03-26 20:17:054 | DEBUG | org.hibernate.jpa.spi.AbstractEntityManagerImpl.markForRollbackOnly() - Mark transaction for rollback
2017-03-26 20:17:055 | DEBUG | org.springframework.orm.jpa.JpaTransactionManager.processRollback() - Initiating transaction rollback
2017-03-26 20:17:055 | DEBUG | org.springframework.orm.jpa.JpaTransactionManager.doRollback() - Rolling back JPA transaction on EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@4674b826]
2017-03-26 20:17:055 | DEBUG | org.hibernate.engine.transaction.internal.TransactionImpl.rollback() - rolling back
2017-03-26 20:17:059 | DEBUG | org.springframework.orm.jpa.JpaTransactionManager.doCleanupAfterCompletion() - Closing JPA EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@4674b826] after transaction
2017-03-26 20:17:059 | DEBUG | org.springframework.orm.jpa.EntityManagerFactoryUtils.closeEntityManager() - Closing JPA EntityManager
这是我做插入数据测试时显示的日志,以上显示事务回滚,说明插入不成功,后来发现是JPA不支持Boolean造成的,虽然按网上做法我加了org.hibernate.annotations.Type,后来发现将Boolean改成boolean,自动生成get和set方法时,get变成了is,这样插入数据又有用,不用org.hibernate.annotations.Type也行!最后的属性以及get和set方法如下:
private boolean married; //这里的Boolean为小写的boolean
@Column(name="isMarried")//name任意取
public boolean isMarried() { //get变成了is
return married;
}
public void setMarried(boolean married) {
this.married = married;
}