在eclipse中运行Hibernate,出现Autocommit mode: false错误 1C

我的Hibernate版本是:5.2.2以下是代码与错误提示
no1
一月 13, 2017 9:25:47 下午 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.2.Final}
一月 13, 2017 9:25:47 下午 org.hibernate.cfg.Environment
INFO: HHH000206: hibernate.properties not found
一月 13, 2017 9:25:47 下午 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
no2
一月 13, 2017 9:25:47 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
一月 13, 2017 9:25:47 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity
WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-mapping. Use namespace http://www.hibernate.org/dtd/hibernate-mapping instead. Support for obsolete DTD/XSD namespaces may be removed at any time.
一月 13, 2017 9:25:48 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
一月 13, 2017 9:25:48 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql:///testhibernate]
一月 13, 2017 9:25:48 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=root, password=****}
一月 13, 2017 9:25:48 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
at org.hibernate.engine.jdbc.connections.internal.PooledConnections.(PooledConnections.java:36)
at org.hibernate.engine.jdbc.connections.internal.PooledConnections.(PooledConnections.java:20)
at org.hibernate.engine.jdbc.connections.internal.PooledConnections$Builder.build(PooledConnections.java:161)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:109)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:72)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:240)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:257)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:231)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:240)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
at org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:179)

at com.hibernate.test1.test.main(test.java:17)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql:///testhibernate</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>

<!-- org.hibernate.dialect.MySQLDialect -->
org.hibernate.dialect.MySQL5InnoDBDialect
update
true

package com.hibernate.test1;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;

public class test {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    StandardServiceRegistry registry=new StandardServiceRegistryBuilder().configure().build();
    SessionFactory sessionfactory=new MetadataSources(registry).buildMetadata().buildSessionFactory();
    Session session=sessionfactory.openSession();
    Transaction transaction=session.beginTransaction();

    log log1=new log();
    log1.setName("nihao");
    log1.setPass("dkjk");
    session.save(log1);

    transaction.commit();



}

}

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">











4个回答

Exception in thread "main" java.lang.NoSuchMethodError是这个报错,应该是包导错了,你查看一下。

导包出现了错误,根据提示导包吧,新手常遇到的问题,尽量多百度,自己解决!

已解决。我把这个web项目建立在tomact服务器上就可以了。。

Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)
jar文件问题,最好maven项目了

http://blog.csdn.net/je_ge/article/details/53235868

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Spring + Hibernate Could not toggle autocommit
org.hibernate.transaction.JDBCTransaction Could not toggle autocommit java.sql.SQLException: Closed Connection org.hibernate.transaction.JDBCTransaction JDBC commit failed java.sql.SQLException: Io exception: Connection reset org.springframework.transaction.TransactionSystemException: Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC commit failed 求大神指导,Spring + Hibernate,隔一段时间会自动挂死,以上是相关异常 数据库是ORACLE的,以下是连接池配置信息 hibernate.c3p0.min_size=1 hibernate.c3p0.max_size=20 hibernate.c3p0.timeout=21600 hibernate.c3p0.max_statements=0 hibernate.c3p0.idle_test_period=1800 hibernate.c3p0.acquire_increment=2 hibernate.c3p0.checkoutTimeout=30000
Hibernate未报error但是运行不成功
Hibernate.cfg.xml如下 ``` <session-factory> <property name="connection.url">jdbc:mysql://localhost:3306/test?useSSL=false</property> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.username">root</property> <property name="connection.password">19981008</property> <!-- JDBC connection pool (use the built-in) --> <property name="connection.pool_size">4</property> <!-- SQL dialect --> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <!-- Enable Hibernate's automatic session context management --> <!--<property name="current_session_context_class">thread</property>--> <!--以格式良好的方式显示SQL语句--> <property name="format_sql">true</property> <!-- Echo all executed SQL to stdout --> <property name="show_sql">true</property> <!-- Drop and re-create the database schema on startup --> <property name="hbm2ddl.auto">update</property> <mapping resource="entities/ProductEntity.hbm.xml"/> <mapping class="entities.ProductEntity"/> <!-- DB schema will be updated if needed --> <!-- <property name="hbm2ddl.auto">update</property> --> </session-factory> ``` AddProduct.java代码如下 ``` public class AddProduct { public static void main(String[] args){ Session session = null; ProductEntity productEntity = new ProductEntity(); productEntity.setId(1001); productEntity.setName("Java web从入门到精通"); productEntity.setPrice(79.9); productEntity.setFactory("曹威"); productEntity.setRemark(2); try{ session = HibernateUtil.getSession(); session.beginTransaction(); //开启事务 session.save(productEntity); //执行数据库添加操作 session.getTransaction(); //事务提交 System.out.println("添加成功"); }catch (Exception e){ session.getTransaction().rollback();//事务回滚 System.out.println("数据添加失败"); e.printStackTrace(); } } } ``` 运行以后控制台输出如下 ``` 七月 13, 2019 3:47:56 下午 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {5.4.3.Final} 七月 13, 2019 3:47:57 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {5.1.0.Final} 七月 13, 2019 3:47:58 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!) 七月 13, 2019 3:47:58 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/test?useSSL=false] 七月 13, 2019 3:47:58 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001001: Connection properties: {user=root, password=****} 七月 13, 2019 3:47:58 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001003: Autocommit mode: false 七月 13, 2019 3:47:58 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init> INFO: HHH000115: Hibernate connection pool size: 4 (min=1) 七月 13, 2019 3:47:58 下午 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect 七月 13, 2019 3:47:59 下午 org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@3a095ec0] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode. 七月 13, 2019 3:47:59 下午 org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator initiateService INFO: HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] ``` 但是数据库并未插入数据 请求解答
hibernate运行总是出错 求解答
一直出错困扰我两天了 求大家帮忙解决一下 谢谢了 一月 18, 2016 11:10:26 下午 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {5.0.7.Final} 一月 18, 2016 11:10:26 下午 org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found 一月 18, 2016 11:10:26 下午 org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist 一月 18, 2016 11:10:26 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-configuration. Use namespace http://www.hibernate.org/dtd/hibernate-configuration instead. Support for obsolete DTD/XSD namespaces may be removed at any time. 一月 18, 2016 11:10:26 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 一月 18, 2016 11:10:27 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!) 一月 18, 2016 11:10:27 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost/hibernate] 一月 18, 2016 11:10:27 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001001: Connection properties: {user=root, password=****} 一月 18, 2016 11:10:27 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001003: Autocommit mode: false 一月 18, 2016 11:10:27 下午 org.hibernate.engine.jdbc.connections.internal.PooledConnections <init> INFO: HHH000115: Hibernate connection pool size: 1 (min=1) 一月 18, 2016 11:10:27 下午 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect 一月 18, 2016 11:10:27 下午 org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl useContextualLobCreation INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4 一月 18, 2016 11:10:28 下午 org.hibernate.tool.hbm2ddl.SchemaExport execute INFO: HHH000227: Running hbm2ddl schema export 一月 18, 2016 11:10:28 下午 org.hibernate.tool.hbm2ddl.SchemaExport execute INFO: HHH000230: Schema export complete org.hibernate.MappingException: Unknown entity: com.hi.Students at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:781) at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1520) at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:100) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192) at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177) at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73) at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:679) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:671) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:666) at com.cat.StudentsTest.testSaveStudents(StudentsTest.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 一月 18, 2016 11:10:28 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop INFO: HHH10001008: Cleaning up connection pool [jdbc:mysql://localhost/hibernate] hibernate.cfg.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost/hibernate</property> <property name="connection.username">root</property> <property name="connection.password">mona</property> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="connection.pool_size">1</property> <property name="show_sql">true</property> <property name="format_sql">true</property> <property name="hbm2ddl.auto">create</property> <mapping resource="com/hi/Students.hbm.xml"/> </session-factory> </hibernate-configuration> Students.hbm.xml <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.hi"> <class name="com.hi.Students" table="STUDENTS"> <id name="id" type="int"> <column name="ID" /> <generator class="assigned" /> </id> <property name="name" type="java.lang.String"> <column name="NAME" /> </property> <property name="age" type="int"> <column name="AGE" /> </property> </class> </hibernate-mapping> Student.java package com.hi; //学生类 public class Students { private int id; private String name; private int age; public Students() { } public Students(int id, String name, int age) { this.id = id; this.name = name; this.age = age; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "Students [id=" + id + ", name=" + name + ", age=" + age + "]"; } } StudentsTest.java package com.cat; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import org.junit.After; import org.junit.Before; import org.junit.Test; import com.hi.Students; public class StudentsTest { private SessionFactory sessionFactory; private Session session; private Transaction transaction; @Before public void init(){ Configuration config = new Configuration().configure(); ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build(); sessionFactory = config.buildSessionFactory(serviceRegistry); session = sessionFactory.openSession(); transaction = session.beginTransaction(); } @After public void destory(){ transaction.commit(); session.close(); sessionFactory.close(); } @Test public void testSaveStudents(){ Students s = new Students(1, "张三丰", 15); session.save(s); } }
怎么回事,Hibernate这样也能成功,但这么多警告,怎么回事?
<font color="red">2015-7-14 20:58:10 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final} 2015-7-14 20:58:10 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.3.10.Final} 2015-7-14 20:58:10 org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found 2015-7-14 20:58:10 org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist 2015-7-14 20:58:10 org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml 2015-7-14 20:58:10 org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: /hibernate.cfg.xml 2015-7-14 20:58:10 org.hibernate.cfg.Configuration addResource INFO: HHH000221: Reading mappings from resource: org/yang/model/Student.hbm.xml 2015-7-14 20:58:10 org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null 2015-7-14 20:58:10 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!) 2015-7-14 20:58:10 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/hibernate] 2015-7-14 20:58:10 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000046: Connection properties: {user=root, password=****} 2015-7-14 20:58:10 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000006: Autocommit mode: false 2015-7-14 20:58:10 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000115: Hibernate connection pool size: 20 (min=1) 2015-7-14 20:58:10 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect 2015-7-14 20:58:10 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4 2015-7-14 20:58:10 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService INFO: HHH000399: Using default transaction strategy (direct JDBC transactions) 2015-7-14 20:58:10 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory</font> Hibernate: insert into student (name, age, id) values (?, ?, ?) <font color="red">2015-7-14 20:58:11 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop INFO: HHH000030: Cleaning up connection pool [jdbc:mysql://localhost:3306/hibernate]</font>
hibernate4.3报错是怎么回事?
2016-10-6 11:01:28 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final} 2016-10-6 11:01:28 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.3.11.Final} 2016-10-6 11:01:28 org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found 2016-10-6 11:01:28 org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist 2016-10-6 11:01:28 org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml 2016-10-6 11:01:28 org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: /hibernate.cfg.xml 2016-10-6 11:01:28 org.hibernate.cfg.Configuration addResource INFO: HHH000221: Reading mappings from resource: com/zpp/pojo/User.hbm.xml 2016-10-6 11:01:29 org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null 2016-10-6 11:01:29 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!) 2016-10-6 11:01:29 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/hibernate4] 2016-10-6 11:01:29 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000046: Connection properties: {user=root, password=****} 2016-10-6 11:01:29 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000006: Autocommit mode: false 2016-10-6 11:01:29 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000115: Hibernate connection pool size: 20 (min=1) 2016-10-6 11:01:29 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect 2016-10-6 11:01:29 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4 2016-10-6 11:01:29 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService INFO: HHH000399: Using default transaction strategy (direct JDBC transactions) 2016-10-6 11:01:29 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory
新手Hibernate写了个小程序,第一次运行报错如下,好像还有数据库连不上的问题,不知道该怎么改
九月 07, 2015 10:31:46 下午 org.hibernate.annotations.common.Version <clinit> INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final} 九月 07, 2015 10:31:46 下午 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.1.4.Final} 九月 07, 2015 10:31:46 下午 org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found 九月 07, 2015 10:31:46 下午 org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist 九月 07, 2015 10:31:46 下午 org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml 九月 07, 2015 10:31:46 下午 org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: /hibernate.cfg.xml 九月 07, 2015 10:31:46 下午 org.hibernate.cfg.Configuration addResource INFO: HHH000221: Reading mappings from resource: com/xdc/Product/Product.hbm.xml 九月 07, 2015 10:31:46 下午 org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null 九月 07, 2015 10:31:46 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!) 九月 07, 2015 10:31:46 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH000148: No JDBC Driver class was specified by property hibernate.connection.driver_class 九月 07, 2015 10:31:46 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000115: Hibernate connection pool size: 20 九月 07, 2015 10:31:46 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000006: Autocommit mode: false 九月 07, 2015 10:31:46 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000401: using driver [null] at URL [jdbc:mysql://localhost:3306/db_database10] 九月 07, 2015 10:31:46 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000046: Connection properties: {user=root, password=****} 九月 07, 2015 10:31:46 下午 org.hibernate.engine.jdbc.internal.JdbcServicesImpl configure WARN: HHH000342: Could not obtain connection to query metadata : No suitable driver found for jdbc:mysql://localhost:3306/db_database10 九月 07, 2015 10:31:46 下午 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect 九月 07, 2015 10:31:46 下午 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation INFO: HHH000422: Disabling contextual LOB creation as connection was null 九月 07, 2015 10:31:46 下午 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService INFO: HHH000399: Using default transaction strategy (direct JDBC transactions) 九月 07, 2015 10:31:46 下午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory 九月 07, 2015 10:31:46 下午 org.hibernate.validator.util.Version <clinit> 信息: Hibernate Validator bean-validator-3.0-JBoss-4.0.2 九月 07, 2015 10:31:46 下午 org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA 信息: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver. 九月 07, 2015 10:31:46 下午 org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA 信息: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver. 九月 07, 2015 10:31:47 下午 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions WARN: SQL Error: 0, SQLState: 08001 九月 07, 2015 10:31:47 下午 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: No suitable driver found for jdbc:mysql://localhost:3306/db_database10 添加数据库失败! org.hibernate.exception.JDBCConnectionException: Could not open connection at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:131) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:304) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169) at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160) at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1396) at com.xdc.main.AddProduct.main(AddProduct.java:19) Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/db_database10 at java.sql.DriverManager.getConnection(DriverManager.java:596) at java.sql.DriverManager.getConnection(DriverManager.java:187) at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:193) at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:281) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297) ... 5 more 配置如下 <hibernate-configuration> <session-factory> <!-- 数据库驱动 --> <property name="connect.driver_class"> com.mysql.jdbc.Driver </property> <!-- 数据库连接的URL --> <property name="connection.url"> jdbc:mysql://localhost:3306/db_database10 </property> <!-- 数据库连接用户名 --> <property name="connection.username">root</property> <!-- 数据库连接密码 --> <property name="connection.password">123321</property> <!-- Hibernate方言 --> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <!-- 打印sql语句 --> <property name="show_sql">true</property> <!-- 映射文件 --> <mapping resource="com/xdc/Product/Product.hbm.xml" /> </session-factory> </hibernate-configuration>
hibernate的hql语句迷惑
[code="java"] public List<FuncInfo> initPermission(int postId) { Session session=sessionFactory.getCurrentSession(); String hql="select f.* from FuncInfo f,Post p,FunPost fp where fp.postId=? and fp.funcInfoId=f.functionId"; Query query=session.createQuery(hql); query.setInteger(0, postId); List<FuncInfo> lists=(List<FuncInfo>)query.list(); return lists; } [/code] 这是方法,但是却报如下异常: [code="java"] 15:33:07,640 DEBUG JDBCTransaction:163 - rolled back JDBC Connection org.hibernate.hql.ast.QuerySyntaxException: expecting IDENT, found '*' near line 1, column 10 [select f.* from com.itsp.funcinfo.dao.model.FuncInfo f,com.itsp.userinfo.dao.model.Post p,com.itsp.userinfo.dao.model.FunPost fp where fp.postId=? and fp.funcInfoId=f.functionId] 15:33:07,531 DEBUG JDBCTransaction:54 - begin 15:33:07,531 DEBUG JDBCTransaction:59 - current autocommit status: true 15:33:07,531 DEBUG JDBCTransaction:62 - disabling autocommit 15:33:07,593 ERROR PARSER:33 - line 1:10: expecting IDENT, found '*' 15:33:07,625 DEBUG JDBCTransaction:152 - rollback 15:33:07,625 DEBUG JDBCTransaction:193 - re-enabling autocommit 15:33:07,640 DEBUG JDBCTransaction:163 - rolled back JDBC Connection [/code] 提示hql语句语法错误,希望大家指教,非常感谢!!!
hibernate创建SessionFactory时发现程序不停止,但是不报错
用hibernate操作的时候出现了一些错误(程序卡住),于是一点点排查,发现程序卡 住的开始是创建SessionFactory的地方,感觉完全无法理解啊。下面是随便写了一个 main方法测试的代码 ``` public static void main(String[] args) { System.out.println(1111); StandardServiceRegistry registry = new StandardServiceRegistryBuilder().configure().build(); try { SessionFactory sessionFactory = new MetadataSources(registry).buildMetadata().buildSessionFactory(); } catch (Exception e) { StandardServiceRegistryBuilder.destroy(registry); } System.out.println(11111111); } ``` 最后在控制台的输出是 ```1111 五月 31, 2017 7:34:55 下午 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {5.2.10.Final} 五月 31, 2017 7:34:55 下午 org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found 五月 31, 2017 7:34:55 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-configuration. Use namespace http://www.hibernate.org/dtd/hibernate-configuration instead. Support for obsolete DTD/XSD namespaces may be removed at any time. 五月 31, 2017 7:34:56 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 五月 31, 2017 7:34:56 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!) Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. 五月 31, 2017 7:34:56 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://123.206.188.226:6666/quantour?useUnicode=true&characterEncoding=UTF-8] 五月 31, 2017 7:34:56 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001001: Connection properties: {user=root, password=****} 五月 31, 2017 7:34:56 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001003: Autocommit mode: false 五月 31, 2017 7:34:56 下午 org.hibernate.engine.jdbc.connections.internal.PooledConnections <init> INFO: HHH000115: Hibernate connection pool size: 20 (min=1) Wed May 31 19:34:56 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 五月 31, 2017 7:34:56 下午 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect 五月 31, 2017 7:34:57 下午 org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@3f363cf5] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode. Hibernate: alter table Board_StockName2Code add constraint FKbhbclwxn6ay8ty114cf53hk5g foreign key (stocks_code) references StockName2Code (code) Hibernate: alter table Board_StockName2Code add constraint FK91v9lg875bgdva3fhtpxicf3u foreign key (Board_boardName) references Board (boardName) 11111111 ``` 但是关键程序没有结束运行?!! ![图片说明](https://img-ask.csdn.net/upload/201705/31/1496231145_994116.png)
spring获取不到hibernate的sessionFactory
错误信息如下 信息: Initializing Spring root WebApplicationContext - Root WebApplicationContext: initialization started - Refreshing Root WebApplicationContext: startup date [Thu Mar 30 21:02:38 CST 2017]; root of context hierarchy - Loading XML bean definitions from file [D:\apache-tomcat-7.0.47\webapps\WorkOrder\WEB-INF\classes\applicationContext.xml] - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@78f77c8e: defining beans [sessionFactory,txManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,pointcut,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0]; root of factory hierarchy - Hibernate Commons Annotations 3.2.0.Final - Hibernate 3.6.8.Final - hibernate.properties not found - Bytecode provider name : javassist - using JDK 1.4 java.sql.Timestamp handling - configuring from url: file:/D:/apache-tomcat-7.0.47/webapps/WorkOrder/WEB-INF/classes/hibernate.cfg.xml - Configured SessionFactory: null - Hibernate Validator not found: ignoring - Building new Hibernate SessionFactory - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. - Using Hibernate built-in connection pool (not for production use!) - Hibernate connection pool size: 20 - autocommit mode: false - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@localhost:1521:orcl - connection properties: {user=system, password=****} - Using dialect: org.hibernate.dialect.Oracle10gDialect - Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException - Database -> 下面是hibernate <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="javax.persistence.validation.mode">none</property> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </property> <property name="connection.url"> jdbc:oracle:thin:@localhost:1521:orcl </property> <property name="connection.username">system</property> <property name="connection.password">a123</property> <property name="dialect"> org.hibernate.dialect.Oracle10gDialect </property> <property name="show_sql">true</property> <property name="format_sql">true</property> </session-factory> </hibernate-configuration> 下面是spring <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation"> <value>classpath:hibernate.cfg.xml</value> </property> </bean>
org.hibernate.MappingException问题?
八月 28, 2015 10:11:04 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {5.0.0.Final} 八月 28, 2015 10:11:04 下午 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.2.20.Final} 八月 28, 2015 10:11:04 下午 org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found 八月 28, 2015 10:11:04 下午 org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist 八月 28, 2015 10:11:04 下午 org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml 八月 28, 2015 10:11:04 下午 org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: /hibernate.cfg.xml 八月 28, 2015 10:11:04 下午 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide! 八月 28, 2015 10:11:04 下午 org.hibernate.cfg.Configuration addResource INFO: HHH000221: Reading mappings from resource: com/aliyun/house1848/hibernate/test/AdminInfo.hbm.xml 八月 28, 2015 10:11:04 下午 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide! 八月 28, 2015 10:11:04 下午 org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null 八月 28, 2015 10:11:04 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!) 八月 28, 2015 10:11:04 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000115: Hibernate connection pool size: 20 八月 28, 2015 10:11:04 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000006: Autocommit mode: false 八月 28, 2015 10:11:04 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000401: using driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] at URL [jdbc:sqlserver://localhost:1433] 八月 28, 2015 10:11:04 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000046: Connection properties: {user=sa, password=****} 八月 28, 2015 10:11:05 下午 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect 八月 28, 2015 10:11:05 下午 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService INFO: HHH000399: Using default transaction strategy (direct JDBC transactions) 八月 28, 2015 10:11:05 下午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:185) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:389) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1799) at com.aliyun.house1848.hibernate.test.HibernateTest.main(HibernateTest.java:35) Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer] at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:138) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:188) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:341) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:506) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:146) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163) ... 4 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:135) ... 13 more Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for registDate in class com.aliyun.house1848.hibernate.test.AdminInfo at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:316) at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:310) at org.hibernate.mapping.Property.getGetter(Property.java:321) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:444) at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:200) at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:82) ... 18 more Exception in thread "main" java.lang.NullPointerException at com.aliyun.house1848.hibernate.test.HibernateTest.main(HibernateTest.java:40) ![图片说明](https://img-ask.csdn.net/upload/201508/28/1440772766_259070.png) 而且javassit.jar包也已经导入了。 这是什么错误?怎么修改呢?
hibernate连接数据库报错
这是hibernate.cfg.xml配置文件,用户名和密码都用jdbc测试过可以连接上 ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.uesrname">root</property> <property name="hibernate.connection.password">liangqichan</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/cql1</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property> <property name="hibernate.hbm2ddl.auto">update</property> <property name="hibernate.show_sql">true</property> <mapping resource="com/cql/crm/domain/SysUserGroup.hbm.xml"/> </session-factory> </hibernate-configuration> ``` 这是报错信息: 2016-6-30 11:56:43 org.hibernate.cfg.Environment <clinit> 信息: Hibernate 3.5.6-Final 2016-6-30 11:56:43 org.hibernate.cfg.Environment <clinit> 信息: hibernate.properties not found 2016-6-30 11:56:43 org.hibernate.cfg.Environment buildBytecodeProvider 信息: Bytecode provider name : javassist 2016-6-30 11:56:43 org.hibernate.cfg.Environment <clinit> 信息: using JDK 1.4 java.sql.Timestamp handling 2016-6-30 11:56:43 org.hibernate.cfg.Configuration configure 信息: configuring from resource: /hibernate.cfg.xml 2016-6-30 11:56:43 org.hibernate.cfg.Configuration getConfigurationInputStream 信息: Configuration resource: /hibernate.cfg.xml 2016-6-30 11:56:43 org.hibernate.cfg.Configuration addResource 信息: Reading mappings from resource : com/cql/crm/domain/SysUserGroup.hbm.xml 2016-6-30 11:56:43 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues 信息: Mapping class: com.cql.crm.domain.SysUserGroup -> sys_user_group 2016-6-30 11:56:43 org.hibernate.cfg.Configuration doConfigure 信息: Configured SessionFactory: null 2016-6-30 11:56:43 org.hibernate.connection.DriverManagerConnectionProvider configure 信息: Using Hibernate built-in connection pool (not for production use!) 2016-6-30 11:56:43 org.hibernate.connection.DriverManagerConnectionProvider configure 信息: Hibernate connection pool size: 20 2016-6-30 11:56:43 org.hibernate.connection.DriverManagerConnectionProvider configure 信息: autocommit mode: false 2016-6-30 11:56:43 org.hibernate.connection.DriverManagerConnectionProvider configure 信息: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/cql1 2016-6-30 11:56:43 org.hibernate.connection.DriverManagerConnectionProvider configure 信息: connection properties: {uesrname=root, password=****} 2016-6-30 11:56:43 org.hibernate.cfg.SettingsFactory buildSettings 警告: Could not obtain connection to query metadata java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES 补充: 这是我测试hibernate时的代码 package junit; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.junit.Test; import com.cql.crm.domain.SysUserGroup; public class TestHibernate { @Test public void testHibernateConf(){ Configuration config=new Configuration(); //config.configure("hibernate.cfg.xml"); config.configure(); SessionFactory sf=config.buildSessionFactory(); Session s=sf.openSession(); Transaction tx=s.beginTransaction(); SysUserGroup sysUserGroup=new SysUserGroup(); sysUserGroup.getName(); sysUserGroup.getPrincipal(); sysUserGroup.getIncumbent(); s.save(sysUserGroup); tx.commit(); s.close(); } } 这是我jdbc连接时的代码: public class jdbc { public static void main(String[] args) { String url="jdbc:mysql://localhost:3306/cql"; String user="root"; String password="liangqichan"; String sql="Select * from sys_user_group"; Connection conn=null; Statement st=null; ResultSet rs=null; try { conn=(Connection) DriverManager.getConnection(url, user, password); st=(Statement) conn.createStatement(); rs=st.executeQuery(sql); while(rs.next()){ System.out.println(rs.getString("id")); System.out.println(rs.getString("name")); System.out.println(rs.getString("remark")); } rs.close(); st.close(); conn.close(); } catch (SQLException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } } }
oracle11g连接Hibernate遇到问题了。连着连着就断开了。求大神解答
``` 2015-9-5 0:04:42 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000006: Autocommit mode: false 2015-9-5 0:04:42 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000401: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@localhost:1521:ORCL] 2015-9-5 0:04:42 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000046: Connection properties: {useUnicode=true, user=hr, password=****, characterEncoding=UTF-8, pool.size=1} 2015-9-5 0:04:43 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.OracleDialect 2015-9-5 0:04:43 or ``` ``` g.hibernate.dialect.Oracle9Dialect <init> WARN: HHH000063: The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10gDialect instead 2015-9-5 0:04:43 org.hibernate.dialect.OracleDialect <init> WARN: HHH000064: The OracleDialect dialect has been deprecated; use Oracle8iDialect instead 2015-9-5 0:04:43 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException 2015-9-5 0:04:43 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService INFO: HHH000399: Using default transaction strategy (direct JDBC transactions) 2015-9-5 0:04:44 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory ``` ------------------------------------------------ 以上是错误信息,下面是我的配置 -------------------------------------------------- ``` <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property> <property name="connection.username">hr</property> <property name="connection.password">08</property> <property name="dialect">org.hibernate.dialect.OracleDialect</property> <property name="show_sql">true</property> <property name="hibernate.connection.pool.size">1</property> <property name="hibernate.statement_cache.size">25</property> <property name="hibernate.jdbc.fetch_size">50</property> <property name="hibernate.jdbc.batch_size">30</property> <property name="connection.useUnicode">true</property> <property name="connection.characterEncoding">UTF-8</property> <mapping resource="com/wx/beans/User.hbm.xml"/> </session-factory> </hibernate-configuration> ``` 求高人解答。。
python 爬虫遇到问题了,这个问题怎么办
我们老师让写一个爬虫,爬东方财富每个股票的历史流动资金,我写出来后,运行程序,前面没什么问题,到后面就有问题了 代码如下:import requests import pandas import json import pymssql import re #获取股票资金流量网页的数据 def GetHtml(url): html=requests.get(url) html=html.text return html #对数据进行拆分 def CleanData(html): Str_data=html[len('jQuery1830006374794149931473_1577602052640')+1:-2] #对数据进行切割 Str_data2=json.loads(Str_data)['data'] #对无用数据进行再切分获取代码和名称 print(Str_data2['code']) code = Str_data2['code'] #股票编码 name = Str_data2['name'] #股票名称 data=[] for i in range (len(Str_data2['klines'])): data.append(Str_data2['klines'][i]) dealData(data,name,code) data.clear() Str_data2.clear() #对拆分数据进行整理 def dealData(datalist,name,code): #对列表中元素进行切片 new_datalist = ''.join(datalist) new_datalist=new_datalist.split(',') Name=name Code=code #将新列表放入数据库中 insertDatabase(new_datalist,Name,Code) new_datalist.clear() #将数据导入数据库中 def insertDatabase(datalist,Name,Code): #对新列表数据进行分类 date=datalist[0] #时间 close_price=datalist[11] #收盘价 Quote_change=datalist[12] #涨跌幅 Main_net=datalist[1] #主力净额 Main_foce=datalist[6] #主力净占比 Over_net=datalist[5] #超大单净额 Over_foce=datalist[10] #超大单净占比 Big_net=datalist[4] #大单净额 Big_foce=datalist[9] #大单净占比 Mid_net=datalist[3] #中单净额 Mid_foce=datalist[8] #中单净占比 Sm_net=datalist[2] #小单净额 Sm_foce=datalist[7] #小单净占比 data=(Name,Code,date,close_price,Quote_change,Main_net,Main_foce,Over_net,Over_foce,Big_net,Big_foce,Mid_net,Mid_foce,Sm_net,Sm_foce) sql="insert into Moneymove values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);" #建立连接 conn = pymssql.connect(host="localhost:1433", user="sa", password="123456", database="test", charset="UTF-8") cursor = conn.cursor() #插入测试数据 cursor.execute(sql , data) conn.commit() del data conn.close() #创建数据库 def Createdatabase(): conn = pymssql.connect(host="localhost:1433", user="sa", password="123456", database="test", charset="UTF-8") cursor = conn.cursor() cursor.execute(""" create table Moneymove( 股票代码 varchar(100), 股票名称 varchar(100), 时间 varchar(100) , 收盘价 varchar(100), 涨跌幅 varchar(100), 主流净额 varchar(100), 主流净占比 varchar(100), 超大单净额 varchar(100), 超大单净占比 varchar(100), 大单净额 varchar(100), 大单净占比 varchar(100), 中单净额 varchar(100), 中单净占比 varchar(100), 小单净额 varchar(100), 小单净占比 varchar(100) ) """) conn.commit() conn.close() # def NeedData(): # 建立连接并获取cursor conn = pymssql.connect(host="localhost:1433", user="sa", password="123456", database="test", charset="UTF-8") cursor = conn.cursor() # 如果连接时没有设置autocommit为True的话,必须主动调用commit() 来保存更改。 conn.commit() # 查询记录 cursor.execute('SELECT 股票代码 From SwClass$ ') # 获取一条记录 row = cursor.fetchone() code_list=[] # 循环打印记录(这里只有一条,所以只打印出一条) for i in range (3769): if row[0] != None: if str(row[0][0]) =='6': code='1.'+row[0] code_list.append(code) else: code = '0.'+row[0] code_list.append(code) row = cursor.fetchone() return code_list # 连接用完后记得关闭以释放资源 conn.close() def main(): Createdatabase() code_list=NeedData() print(code_list) for i in code_list: url='http://push2his.eastmoney.com/api/qt/stock/fflow/daykline/get?lmt=0&klt=101&secid='+ str(i)+'&fields1=f1,f2,f3,f7&fields2=f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64,f65&ut=b2884a393a59ad64002292a3e90d46a5&cb=jQuery1830006374794149931473_1577602052640&_=1577602052949' html=GetHtml(url) CleanData(html) main() 出现的问题是这个: Traceback (most recent call last): File "C:/Users/VULCAN/Desktop/爬虫实习/3.py", line 135, in <module> main() File "C:/Users/VULCAN/Desktop/爬虫实习/3.py", line 134, in main CleanData(html) File "C:/Users/VULCAN/Desktop/爬虫实习/3.py", line 25, in CleanData dealData(data,name,code) File "C:/Users/VULCAN/Desktop/爬虫实习/3.py", line 39, in dealData insertDatabase(new_datalist,Name,Code) File "C:/Users/VULCAN/Desktop/爬虫实习/3.py", line 65, in insertDatabase conn = pymssql.connect(host="localhost:1433", user="sa", password="123456", database="test", charset="UTF-8") File "src\pymssql.pyx", line 636, in pymssql.connect File "src\_mssql.pyx", line 1957, in _mssql.connect File "src\_mssql.pyx", line 675, in _mssql.MSSQLConnection.__init__ ValueError: list.remove(x): x not in list 请问各位大佬,这要如何解决?
hibernate5 问题,使用注解
``` <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost:3306/mytest</property> <property name="connection.username">root</property> <property name="connection.password">zys123</property> <property name="show_sql">true</property> <property name="format_sql">true</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hbm2ddl.auto">update</property> <mapping class="persistence.Message" /> </session-factory> </hibernate-configuration> package persistence; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Message { @Id @GeneratedValue(generator="ID_GENERATOR") private Long id; private String text; private Message nextMessage; Message(){} public Message(String text){ this.text = text; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getText() { return text; } public void setText(String text) { this.text = text; } public Message getNextMessage() { return nextMessage; } public void setNextMessage(Message nextMessage) { this.nextMessage = nextMessage; } } package Deal; import java.util.*; import org.hibernate.*; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import persistence.*; public class Hello { public static void main(String[] args){ StandardServiceRegistry serviceRegistry=new StandardServiceRegistryBuilder().configure("hibernate.cfg.xml").build(); MetadataSources m = new MetadataSources(serviceRegistry); m.addAnnotatedClass(persistence.Message.class); SessionFactory sessionFactory=m.buildMetadata(serviceRegistry).buildSessionFactory(); Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); Message message = new Message("Hello World"); session.save(message); // session.persist(message); tx.commit(); session.close(); Session newSession = sessionFactory.openSession(); Transaction newTransaction = newSession.beginTransaction(); List messages = newSession.createQuery("from Message m order by m.text asc").getResultList(); System.out.println(messages.size()+"message(s) found:"); for(Iterator<Message> iter = messages.iterator();iter.hasNext();){ Message loadeMsg = iter.next(); System.out.println(loadeMsg.getText()); } newTransaction.commit(); newSession.close(); sessionFactory.close(); } } 十一月 29, 2016 7:42:38 下午 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {5.2.3.Final} 十一月 29, 2016 7:42:38 下午 org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found 十一月 29, 2016 7:42:38 下午 org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist 十一月 29, 2016 7:42:38 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-configuration. Use namespace http://www.hibernate.org/dtd/hibernate-configuration instead. Support for obsolete DTD/XSD namespaces may be removed at any time. 十一月 29, 2016 7:42:38 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 十一月 29, 2016 7:42:38 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!) 十一月 29, 2016 7:42:38 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/mytest] 十一月 29, 2016 7:42:38 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001001: Connection properties: {user=root, password=****} 十一月 29, 2016 7:42:38 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001003: Autocommit mode: false 十一月 29, 2016 7:42:38 下午 org.hibernate.engine.jdbc.connections.internal.PooledConnections <init> INFO: HHH000115: Hibernate connection pool size: 20 (min=1) Tue Nov 29 19:42:38 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 十一月 29, 2016 7:42:38 下午 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver at org.hibernate.boot.internal.ClassmateContext.<init>(ClassmateContext.java:16) at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:118) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:113) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) at org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:183) at Deal.Hello.main(Hello.java:17) Caused by: java.lang.ClassNotFoundException: com.fasterxml.classmate.TypeResolver at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 8 more ``` 求大神帮忙,调试好长时间不行啊
hibernate 查询出现回滚 为什么
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.rollback(LocalManagedConnection.java:97) at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.tidyup(TxConnectionManager.java:783) at org.jboss.resource.connectionmanager.BaseConnectionManager2.returnManagedConnection(BaseConnectionManager2.java:453) at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnectionManager.java:734) at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:362) at org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:155) at org.hibernate.connection.DatasourceConnectionProvider.closeConnection(DatasourceConnectionProvider.java:97) at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:474) at org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:429) at org.hibernate.jdbc.ConnectionManager.afterStatement(ConnectionManager.java:304) at org.hibernate.jdbc.AbstractBatcher.closePreparedStatement(AbstractBatcher.java:572) at org.hibernate.jdbc.AbstractBatcher.closeStatement(AbstractBatcher.java:291) at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:307) at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:234) at org.hibernate.loader.Loader.doQuery(Loader.java:749) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loader.java:2228) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125) at org.hibernate.loader.Loader.list(Loader.java:2120) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306) 数据源用的JNDI配置在JBOSS服务器下,获取连接都没有问题,但是在执行查询的时候出现了回滚,因为数据库是mysql autocommit=true所以回滚不了,异常被抛了出来,我的问题是为什么这里查询会出现回滚?查看了hibernate和jboss源码,只能猜测是在close连接的发现连接已经断开,所以回滚,但是这项目在做JBOSS隔离之前没有这个问题,做了JBOSS隔离只有出现了这个问题,而且还不是必然的是偶然的,找了好几天,实在无能无力,求民间大神指一条明路吧
SchemaExport export自动创建表失败
package entity; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.tool.hbm2ddl.SchemaExport; import org.junit.Test; public class TestStudents { @Test public void testSchemaExport() { //创建配置对象 Configuration config = new Configuration().configure(); //创建服务注册对象 ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry(); //创建sessionFactory SessionFactory sessionFactory = config.buildSessionFactory(serviceRegistry); //创建session对象 Session session = sessionFactory.getCurrentSession(); //创建SchemaExport对象 SchemaExport export = new SchemaExport(config); export.create(true, true); } } 九月 20, 2015 2:40:45 上午 org.hibernate.annotations.common.Version <clinit> INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final} 九月 20, 2015 2:40:46 上午 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.2.4.Final} 九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found 九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist 九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml 九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: /hibernate.cfg.xml 九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Configuration addResource INFO: HHH000221: Reading mappings from resource: entity/Students.hbm.xml 九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Configuration addResource INFO: HHH000221: Reading mappings from resource: entity/Users.hbm.xml 九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null 九月 20, 2015 2:40:46 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!) 九月 20, 2015 2:40:46 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000115: Hibernate connection pool size: 20 九月 20, 2015 2:40:46 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000006: Autocommit mode: false 九月 20, 2015 2:40:46 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql:///test?useUnicode=true&characterEncoding=UTF-8] 九月 20, 2015 2:40:46 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000046: Connection properties: {user=root, password=****} 九月 20, 2015 2:40:46 上午 org.hibernate.engine.jdbc.internal.JdbcServicesImpl configure WARN: HHH000342: Could not obtain connection to query metadata : Access denied for user 'root'@'localhost' (using password: NO) 九月 20, 2015 2:40:46 上午 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect 九月 20, 2015 2:40:46 上午 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation INFO: HHH000422: Disabling contextual LOB creation as connection was null 九月 20, 2015 2:40:46 上午 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService INFO: HHH000399: Using default transaction strategy (direct JDBC transactions) 九月 20, 2015 2:40:46 上午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory
hibernate多对多问题,求解决!
# 映射文件如下: ``` <hibernate-mapping> <class name="com.bdqn.entity.Student" table="STUDENT"> <id name="id" type="java.lang.Integer" column="STUID"> <generator class="sequence"> <param name="sequence">sequence_stuid</param> </generator> </id> <property name="name" type="java.lang.String" column="STUNAME" /> <set name="teacherSet" table="TEASTU" cascade="save-update"> <key column="MSTUID" /> <many-to-many class="com.bdqn.entity.Teacher" column="MTEAID" /> </set> </class> </hibernate-mapping> ``` ------------------------------------------------------------------- ``` <hibernate-mapping> <class name="com.bdqn.entity.Teacher" table="TEACHER"> <id name="id" type="java.lang.Integer" column="TEAID"> <generator class="sequence"> <param name="sequence">sequence_teaid</param> </generator> </id> <property name="name" type="java.lang.String" column="TEANAME" /> <set name="studentSet" table="TEASTU" inverse="true"> <key column="MTEAID" /> <many-to-many class="com.bdqn.entity.Student" column="MSTUID" /> </set> </class> </hibernate-mapping> ``` ************************************************************************* ``` @Test public void testSave2() { Configuration cfg = null; ServiceRegistry sr = null; SessionFactory sf = null; Session session = null; Transaction tx = null; try { cfg = new Configuration().configure("hibernate.cfg.xml"); sr = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()).build(); sf = cfg.buildSessionFactory(sr); System.out.println("SessionFactory --> " + sf); session = sf.openSession(); System.out.println("SESSION --> " + session); tx = session.beginTransaction(); // 创建对象 Teacher t1 = new Teacher("韩老师"); Teacher t2 = new Teacher("王老师"); Student s1 = new Student("小明"); Student s2 = new Student("小蓝"); // 建立关联关系 t1.getStudentSet().add(s1); t1.getStudentSet().add(s2); t2.getStudentSet().add(s2); s1.getTeacherSet().add(t1); s2.getTeacherSet().add(t1); s2.getTeacherSet().add(t2); // 由主动方维护关联关系 inverse="false" session.save(s1); session.save(s2); tx.commit(); System.out.println("transaction commit."); } catch (Exception e) { tx.rollback(); System.out.println("transaction rollback."); } finally { if (session != null) session.close(); System.out.println("session closed."); } } ``` ## 执行以上方法时为什么事务不会提交? ## 控制台信息: ``` 八月 22, 2015 6:49:48 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final} 八月 22, 2015 6:49:48 下午 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.3.10.Final} 八月 22, 2015 6:49:48 下午 org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found 八月 22, 2015 6:49:48 下午 org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist 八月 22, 2015 6:49:48 下午 org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: hibernate.cfg.xml 八月 22, 2015 6:49:48 下午 org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: hibernate.cfg.xml 八月 22, 2015 6:49:48 下午 org.hibernate.cfg.Configuration addResource INFO: HHH000221: Reading mappings from resource: com/bdqn/entity/Student.hbm.xml 八月 22, 2015 6:49:48 下午 org.hibernate.cfg.Configuration addResource INFO: HHH000221: Reading mappings from resource: com/bdqn/entity/Teacher.hbm.xml 八月 22, 2015 6:49:48 下午 org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null 八月 22, 2015 6:49:48 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!) 八月 22, 2015 6:49:48 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000401: using driver [oracle.jdbc.OracleDriver] at URL [jdbc:oracle:thin:@localhost:1521:orcl] 八月 22, 2015 6:49:48 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000046: Connection properties: {user=rolland, password=****} 八月 22, 2015 6:49:48 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000006: Autocommit mode: false 八月 22, 2015 6:49:48 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000115: Hibernate connection pool size: 20 (min=1) 八月 22, 2015 6:49:49 下午 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect 八月 22, 2015 6:49:49 下午 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService INFO: HHH000399: Using default transaction strategy (direct JDBC transactions) 八月 22, 2015 6:49:49 下午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory SessionFactory --> org.hibernate.internal.SessionFactoryImpl@52815fa3 SESSION --> SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=org.hibernate.engine.spi.ExecutableList@5e403b4a updates=org.hibernate.engine.spi.ExecutableList@5117dd67 deletions=org.hibernate.engine.spi.ExecutableList@5be49b60 orphanRemovals=org.hibernate.engine.spi.ExecutableList@2931522b collectionCreations=org.hibernate.engine.spi.ExecutableList@7674b62c collectionRemovals=org.hibernate.engine.spi.ExecutableList@19e7a160 collectionUpdates=org.hibernate.engine.spi.ExecutableList@662706a7 collectionQueuedOps=org.hibernate.engine.spi.ExecutableList@45a4b042 unresolvedInsertDependencies=UnresolvedEntityInsertActions[]]) **transaction rollback.** session closed. ```
javaweb小项目,写添加功能时出错了检查了几遍sql没找到错误,但从报错信息来看是sql写错了?
在写emp这张表的添加功能时遇到错误了,但是找不到解决的办法。。。。 sql语句检查好几遍了,也找不到是哪里错了。 下面是图和错误信息。 ![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894627_921952.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894635_586062.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894640_845708.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894648_593949.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894656_691023.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894666_634817.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894683_320059.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894687_712206.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894695_287559.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894700_310688.png) 错误信息:在表单页面点击立即提交就报错 ``` [2019-12-09 08:10:13,721] Artifact 人事工资管理系统(psms):war exploded: Artifact is being deployed, please wait... 09-Dec-2019 20:10:14.925 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。 [2019-12-09 08:10:15,033] Artifact 人事工资管理系统(psms):war exploded: Artifact is deployed successfully [2019-12-09 08:10:15,033] Artifact 人事工资管理系统(psms):war exploded: Deploy took 1,312 milliseconds DEBUG [http-nio-555-exec-5] - Logging initialized using 'class org.apache.ibatis.logging.log4j.Log4jImpl' adapter. DEBUG [http-nio-555-exec-5] - PooledDataSource forcefully closed/removed all connections. DEBUG [http-nio-555-exec-5] - PooledDataSource forcefully closed/removed all connections. DEBUG [http-nio-555-exec-5] - PooledDataSource forcefully closed/removed all connections. DEBUG [http-nio-555-exec-5] - PooledDataSource forcefully closed/removed all connections. DEBUG [http-nio-555-exec-5] - Opening JDBC Connection DEBUG [http-nio-555-exec-5] - Created connection 1428244206. DEBUG [http-nio-555-exec-5] - Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-5] - ==> Preparing: select * from emp where username=? and password=? DEBUG [http-nio-555-exec-5] - ==> Parameters: root(String), aias(String) DEBUG [http-nio-555-exec-5] - <== Total: 1 DEBUG [http-nio-555-exec-5] - Resetting autocommit to true on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-5] - Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-5] - Returned connection 1428244206 to pool. 09-Dec-2019 20:10:23.398 信息 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [C:\apache-tomcat-9.0.27-windows-x64\apache-tomcat-9.0.27\webapps\manager] 09-Dec-2019 20:10:23.482 信息 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\apache-tomcat-9.0.27-windows-x64\apache-tomcat-9.0.27\webapps\manager] has finished in [83] ms DEBUG [http-nio-555-exec-10] - Opening JDBC Connection DEBUG [http-nio-555-exec-10] - Checked out connection 1428244206 from pool. DEBUG [http-nio-555-exec-10] - Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-10] - ==> Preparing: select max(id) from emp DEBUG [http-nio-555-exec-10] - ==> Parameters: DEBUG [http-nio-555-exec-10] - <== Total: 1 DEBUG [http-nio-555-exec-10] - Resetting autocommit to true on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-10] - Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-10] - Returned connection 1428244206 to pool. DEBUG [http-nio-555-exec-10] - Opening JDBC Connection DEBUG [http-nio-555-exec-10] - Checked out connection 1428244206 from pool. DEBUG [http-nio-555-exec-10] - Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-10] - ==> Preparing: insert into emp(id,empno,username,password,ename,sex,birthday,email,call,pname,deptno,state,permissions) values (?,?,?,?,?,?,?,?,?,?,?,?,?) DEBUG [http-nio-555-exec-10] - ==> Parameters: 28(Integer), 028(String), test(String), test(String), 测试(String), 男(String), 2019-12-09(String), 777777777@qq.com(String), 11111111111(String), 接待员(String), 001(String), 在职(String), 普通员工(String) java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) DEBUG [http-nio-555-exec-10] - Rolling back JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] at java.lang.reflect.Method.invoke(Method.java:498) DEBUG [http-nio-555-exec-10] - Resetting autocommit to true on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-10] - Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] at com.cdx.psms.utils.TransactionInvocationHandler.invoke(TransactionInvocationHandler.java:30) DEBUG [http-nio-555-exec-10] - Returned connection 1428244206 to pool. at com.sun.proxy.$Proxy5.add(Unknown Source) at com.cdx.psms.controller.Emp_InsertAddServlet.doPost(Emp_InsertAddServlet.java:46) at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1579) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'call,pname,deptno,state,permissions) values (28,'028','test','te' at line 2 ### The error may exist in com/cdx/psms/mapper/EmpMapper.xml ### The error may involve emp.add-Inline ### The error occurred while setting parameters ### SQL: insert into emp(id,empno,username,password,ename,sex,birthday,email,call,pname,deptno,state,permissions) values (?,?,?,?,?,?,?,?,?,?,?,?,?) ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'call,pname,deptno,state,permissions) values (28,'028','test','te' at line 2 at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184) at com.cdx.psms.dao.EmpDaoImpl.add(EmpDaoImpl.java:42) at com.cdx.psms.service.EmpServiceImpl.add(EmpServiceImpl.java:26) ... 31 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'call,pname,deptno,state,permissions) values (28,'028','test','te' at line 2 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1912) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1251) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59) at com.sun.proxy.$Proxy7.execute(Unknown Source) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197) ... 34 more ```
maven 反向生成实体项目问题
想在eclipse里面弄一个maven的反向生成实体工程,配置好之后运行一直不生成实体,运行过程也不报错,运行命令使用的:hibernate3:hbm2java ,配置文件如下: pom.xml ``` <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>AAAAA</groupId> <artifactId>AAAAA</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <groupId>AAAAA_PO</groupId> <artifactId>AAAAA_PO</artifactId> <name>AAAAA_PO</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> </dependencies> <build> <finalName>AAAAA_PO</finalName> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.2</version> <dependencies> <!-- mysql链接驱动,如果是Oracle的就换成Oracle的驱动 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.25</version> </dependency> --> <!-- oracle 链接驱动 --> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.1.0</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>ejb3-persistence</artifactId> <version>3.3.2.Beta1</version> </dependency> </dependencies> <!-- 运行命令: mvn hibernate3:hbm2java hibernate3:hbm2hbmxml --> <configuration> <components> <!-- 映射文件夹 项目目录下运行命令:mvn hibernate3:hbm2hbmxml --> <component> <name>hbm2hbmxml</name> <implementation>jdbcconfiguration</implementation> <outputDirectory>src/main/java/</outputDirectory> </component> <!-- 实体类 项目目录下运行命令:mvn hibernate3:hbm2java --> <component> <name>hbm2java</name> <outputDirectory>src/main/java/</outputDirectory> <implementation>jdbcconfiguration</implementation> </component> </components> <componentProperties> <!-- 生成指定表名的实体类和映射文件(不配置则生成所有的数据表) --> <revengfile>src/main/resources/reveng/hibernate.reveng.xml</revengfile> <!-- hibernate总配置文件,注意是链接数据库的信息 --> <configurationfile>src/main/resources/reveng/hibernate.cfg.xml</configurationfile> <!-- 输出的包名 --> <packagename>org</packagename> <!-- true为注解实体类方式,只需要生成java类即可,false为映射文件和非注解java实体类,结合 --> <ejb3>true</ejb3> </componentProperties> <!-- 1、如果你要生成注解方式的 java文件,就运行 mvn hibernate3:hbm2java 2、如果你要生成 hbm.xml 配合 java 的形式就先把 pom 里面 <ejb3>false</ejb3> 弄成false 然后分别运行 mvn hibernate3:hbm2hbmxml 和 mvn hibernate3:hbm2java --> </configuration> </plugin> </plugins> </build> </project> ``` hibernate.cfg.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property> <property name="hibernate.connection.password">fj_inms</property> <property name="hibernate.connection.url">jdbc:oracle:thin:@127.0.0.1:1521:testOrac</property> <property name="hibernate.connection.username">fj_inms</property> <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property> </session-factory> </hibernate-configuration> ``` hibernate.reveng.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"> <hibernate-reverse-engineering> <table-filter match-name="sys_organization"/> </hibernate-reverse-engineering> ``` 运行配置 ``` hibernate3:hbm2java ``` 运行控制台打印 ``` [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building AAAAA_PO 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> hibernate3-maven-plugin:2.2:hbm2java (default-cli) > process-resources @ AAAAA_PO >>> [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ AAAAA_PO --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] [INFO] <<< hibernate3-maven-plugin:2.2:hbm2java (default-cli) < process-resources @ AAAAA_PO <<< [INFO] [INFO] --- hibernate3-maven-plugin:2.2:hbm2java (default-cli) @ AAAAA_PO --- [INFO] using jdbcconfiguration task. [INFO] Hibernate 3.3.1.GA [INFO] hibernate.properties not found [INFO] Bytecode provider name : javassist [INFO] using JDK 1.4 java.sql.Timestamp handling [INFO] Configuration XML file loaded: file:/E:/work/workspace_mars/AAAAA/AAAAA_PO/src/main/resources/reveng/hibernate.cfg.xml [INFO] configuring from url: file:/E:/work/workspace_mars/AAAAA/AAAAA_PO/src/main/resources/reveng/hibernate.cfg.xml [INFO] Configured SessionFactory: null [INFO] No hibernate properties file loaded. [INFO] Override file: E:\work\workspace_mars\AAAAA\AAAAA_PO\src\main\resources\reveng\hibernate.reveng.xml [INFO] Using Hibernate built-in connection pool (not for production use!) [INFO] Hibernate connection pool size: 20 [INFO] autocommit mode: false [INFO] using driver: oracle.jdbc.OracleDriver at URL: jdbc:oracle:thin:@127.0.0.1:1521:testOrac [INFO] connection properties: {user=fj_inms, password=****} [INFO] RDBMS: Oracle, version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options [INFO] JDBC driver: Oracle JDBC driver, version: 11.2.0.1.0 [INFO] Using dialect: org.hibernate.dialect.Oracle10gDialect [INFO] Using default transaction strategy (direct JDBC transactions) [INFO] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) [INFO] Automatic flush during beforeCompletion(): disabled [INFO] Automatic session close at end of transaction: disabled [INFO] JDBC batch size: 15 [INFO] JDBC batch updates for versioned data: disabled [INFO] Scrollable result sets: enabled [INFO] JDBC3 getGeneratedKeys(): disabled [INFO] Connection release mode: auto [INFO] Default batch fetch size: 1 [INFO] Generate SQL with comments: disabled [INFO] Order SQL updates by primary key: disabled [INFO] Order SQL inserts for batching: disabled [INFO] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory [INFO] Using ASTQueryTranslatorFactory [INFO] Query language substitutions: {} [INFO] JPA-QL strict compliance: disabled [INFO] Second-level cache: enabled [INFO] Query cache: disabled [INFO] Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory [INFO] Optimize cache for minimal puts: disabled [INFO] Structured second-level cache entries: disabled [INFO] Statistics: disabled [INFO] Deleted entity synthetic identifier rollback: disabled [INFO] Default entity-mode: pojo [INFO] Named query checking : enabled [INFO] cleaning up connection pool: jdbc:oracle:thin:@127.0.0.1:1521:testOrac [INFO] Hibernate Tools 3.2.2.GA [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.482 s [INFO] Finished at: 2017-01-16T22:12:45+08:00 [INFO] Final Memory: 18M/246M [INFO] ------------------------------------------------------------------------ [INFO] cleaning up connection pool: jdbc:oracle:thin:@127.0.0.1:1521:testOrac ```
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、PDF搜索网站推荐 对于大部
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
Vue + Spring Boot 项目实战(十四):用户认证方案与完善的访问拦截
本篇文章主要讲解 token、session 等用户认证方案的区别并分析常见误区,以及如何通过前后端的配合实现完善的访问拦截,为下一步权限控制的实现打下基础。
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入  假设现有4个人
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
SQL-小白最佳入门sql查询一
一 说明 如果是初学者,建议去网上寻找安装Mysql的文章安装,以及使用navicat连接数据库,以后的示例基本是使用mysql数据库管理系统; 二 准备前提 需要建立一张学生表,列分别是id,名称,年龄,学生信息;本示例中文章篇幅原因SQL注释略; 建表语句: CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // dosho
漫话:什么是平衡(AVL)树?这应该是把AVL树讲的最好的文章了
这篇文章通过对话的形式,由浅入深带你读懂 AVL 树,看完让你保证理解 AVL 树的各种操作,如果觉得不错,别吝啬你的赞哦。 1、若它的左子树不为空,则左子树上所有的节点值都小于它的根节点值。 2、若它的右子树不为空,则右子树上所有的节点值均大于它的根节点值。 3、它的左右子树也分别可以充当为二叉查找树。 例如: 例如,我现在想要查找数值为14的节点。由于二叉查找树的特性,我们可...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
开源并不是你认为的那些事
点击上方蓝字 关注我们开源之道导读所以 ————想要理清开源是什么?先要厘清开源不是什么,名正言顺是句中国的古代成语,概念本身的理解非常之重要。大部分生物多样性的起源,...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
      11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI 算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下
《C++ Primer》学习笔记(六):C++模块设计——函数
专栏C++学习笔记 《C++ Primer》学习笔记/习题答案 总目录 https://blog.csdn.net/TeFuirnever/article/details/100700212 —————————————————————————————————————————————————————— 《C++ Primer》习题参考答案:第6章 - C++模块设计——函数 文章目录专栏C+...
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车? 某胡同口的煎饼摊一年能卖出多少个煎饼? 深圳有多少个产品经理? 一辆公交车里能装下多少个乒乓球? 一
so easy! 10行代码写个"狗屁不通"文章生成器
前几天,GitHub 有个开源项目特别火,只要输入标题就可以生成一篇长长的文章。背后实现代码一定很复杂吧,里面一定有很多高深莫测的机器学习等复杂算法不过,当我看了源代码之后这程序不到50
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的 回答 - Bravo Yeung,获得该问题下回答中得最高赞(236赞和1枚专业勋章),对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalk
相关热词 c# clr dll c# 如何orm c# 固定大小的字符数组 c#框架设计 c# 删除数据库 c# 中文文字 图片转 c# 成员属性 接口 c#如何将程序封装 16进制负数转换 c# c#练手项目
立即提问