Guest User

Untitled

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