Advertisement
Guest User

Untitled

a guest
Mar 8th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. <dependency>
  2. <groupId>org.hibernate</groupId>
  3. <artifactId>hibernate-entitymanager</artifactId>
  4. <version>4.3.11.Final</version>
  5. </dependency>
  6.  
  7. <dependency>
  8. <groupId>org.hibernate</groupId>
  9. <artifactId>hibernate-entitymanager</artifactId>
  10. <version>5.1.0.Final</version>
  11. </dependency>
  12.  
  13. @Id
  14. @GeneratedValue(strategy=GenerationType.AUTO)
  15. @Column(unique=true, nullable=false, updatable = false)
  16. private int idconcept;
  17.  
  18. @Column(name="action_date", nullable=false)
  19. protected LocalDate actionDate;
  20.  
  21. ...
  22.  
  23. public Concept() {}
  24.  
  25. ...
  26.  
  27. Exception: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
  28.  
  29.  
  30. In the stack, the cause is :
  31. "errorCode": 1146,
  32. "nextException": null,
  33. "sqlstate": "42S02",
  34. "localizedMessage": "Table 'roles.concept' doesn't exist",
  35. "message": "Table 'roles.concept' doesn't exist",
  36. "suppressed": []
  37.  
  38. in the log of hibernate, i saw the sql order doesn't contain the schema.
  39.  
  40. Sql order with hibernate 5
  41.  
  42. select concept0_.idconcept as idconcep1_0_, concept0_.action_date a saction_d2_0_, ..., from concept concept0_
  43.  
  44. Sql order before with hibernate 4.3.11
  45.  
  46. select concept0_.idconcept as idconcep1_0_, concept0_.action_date a saction_d2_0_, ..., from modeler.concept concept0_
  47.  
  48. Exception: org.hibernate.exception.SQLGrammarException: error performing isolated work
  49.  
  50. In the stack, the cause is
  51. "errorCode": 1146,
  52. "nextException": null,
  53. "sqlstate": "42S02",
  54. "localizedMessage": "Table 'roles.hibernate_sequence' doesn't exist",
  55. "message": "Table 'roles.hibernate_sequence' doesn't exist",
  56. "suppressed": []
  57.  
  58.  
  59. in the log of hibernate, the sql order doesn't contain the schema.
  60.  
  61. select next_val as id_val from hibernate_sequence for update
  62.  
  63. --> but, it's seems that it's the same schema problem as in read access.
  64.  
  65. <tx:annotation-driven transaction-manager="transactionManager" />
  66. <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  67. <property name="entityManagerFactory" ref="entityManagerFactory" />
  68. </bean>
  69.  
  70.  
  71. <bean id="entityManagerFactory"
  72. class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  73. <property name="persistenceXmlLocation" value="classpath:config/persistence.xml" />
  74. <property name="persistenceUnitName" value="demoRestPersistence" />
  75. <property name="dataSource" ref="restDemoDS" />
  76. <property name="jpaVendorAdapter">
  77. <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
  78. </bean>
  79. </property>
  80.  
  81. <property name="jpaPropertyMap">
  82. <map>
  83. <entry key="hibernate.show_sql" value="true" />
  84. <entry key="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
  85. <entry key="hibernate.implicit_naming_strategy" value="org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl" />
  86. </map>
  87. </property>
  88.  
  89. </bean>
  90.  
  91. <bean id="restDemoDS"
  92. class="org.springframework.jdbc.datasource.DriverManagerDataSource"
  93. scope="singleton">
  94. <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  95. <property name="url" value="jdbc:mysql://localhost:3306/roles" />
  96. <property name="username" value="root" />
  97. <property name="password" value="un2trois" />
  98. </bean>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement