hibernate

Bulk insertion of CollectionTable elements in Hibernate / JPA

和自甴很熟 提交于 2021-02-10 09:45:44
问题 We are using Hibernate 4.2 as the backing library for JPA 2.0 entities. We have an entity like the following: @Entity public class MyEntity { .... @ElementCollection @MapKeyColumn(name = "key") @Column(name = "value") @CollectionTable("MyEntityMap") private Map<String, Integer> theMap; ... } The map potentially has thousands of entries. I have set hibernate.jdbc.batch_size=50 , but Hibernate still generates an insert statement for each entry in the map, when I say entityManager.persist

Bulk insertion of CollectionTable elements in Hibernate / JPA

梦想的初衷 提交于 2021-02-10 09:45:31
问题 We are using Hibernate 4.2 as the backing library for JPA 2.0 entities. We have an entity like the following: @Entity public class MyEntity { .... @ElementCollection @MapKeyColumn(name = "key") @Column(name = "value") @CollectionTable("MyEntityMap") private Map<String, Integer> theMap; ... } The map potentially has thousands of entries. I have set hibernate.jdbc.batch_size=50 , but Hibernate still generates an insert statement for each entry in the map, when I say entityManager.persist

Creating tables and importing data from .sql files in Spring boot

故事扮演 提交于 2021-02-10 06:42:08
问题 Current apporach: application.properties spring.datasource.url=jdbc:mysql://localhost:3306/db_name spring.datasource.username=root spring.datasource.password=admin spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.testWhileIdle = true spring.datasource.validationQuery = SELECT 1 spring.jpa.show-sql = true spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy spring.jpa.properties.hibernate.dialect=org

JPA+ORACLE: Can't pass boolean param to my stored procedure

旧时模样 提交于 2021-02-10 05:42:05
问题 I can not pass boolean param to my stored procedure in Oracle. If I set value directly in the query text (mypackage.Test(?, false, ?, ?);) all work fine... jdbc-driver: ojdbc6.jar container: Tomcat 7.0.28 hibernate-core+hibernate-entitymanager: 4.1.6.Final oracle: Oracle Database 11g Release 11.2.0.2.0 - 64bit Production Here my realization: EntityManager em = defaultFactory.createEntityManager(); em.createNativeQuery("BEGIN mypackage.Test(?, ?, ?, ?); END;")// .setParameter(1, factId)//

Automatic retry of transactions/requests in Dropwizard/JPA/Hibernate

爱⌒轻易说出口 提交于 2021-02-10 05:14:51
问题 I am currently implementing a REST API web service using the Dropwizard framework together with dropwizard-hibernate respectively JPA/Hibernate (using a PostgreSQL database). I have a method inside a resource which I annotated with @UnitOfWork to get one transaction for the whole request. The resource method calls a method of one of my DAOs which extends AbstractDAO<MyEntity> and is used to communicate retrieval or modification of my entities (of type MyEntity ) with the database. This DAO

Hibernate Restrictions / Criteria Beginner Question

萝らか妹 提交于 2021-02-10 03:59:43
问题 Hi I have been trying to work out the best way to do this today to no avail. What I would ideally like to do is to create an alias distance calculated by the SQL formula below (although I am open to other ways of calculating the distance, this was just the way that seemed it should be easiest) Once I have that alias I want to be able to use it in a Restrictions fashion to find all that are within a certain distance. I would also like to be able to sort via distance. This is part of a bigger

Hibernate Restrictions / Criteria Beginner Question

最后都变了- 提交于 2021-02-10 03:58:07
问题 Hi I have been trying to work out the best way to do this today to no avail. What I would ideally like to do is to create an alias distance calculated by the SQL formula below (although I am open to other ways of calculating the distance, this was just the way that seemed it should be easiest) Once I have that alias I want to be able to use it in a Restrictions fashion to find all that are within a certain distance. I would also like to be able to sort via distance. This is part of a bigger

Hibernate Restrictions / Criteria Beginner Question

Deadly 提交于 2021-02-10 03:57:40
问题 Hi I have been trying to work out the best way to do this today to no avail. What I would ideally like to do is to create an alias distance calculated by the SQL formula below (although I am open to other ways of calculating the distance, this was just the way that seemed it should be easiest) Once I have that alias I want to be able to use it in a Restrictions fashion to find all that are within a certain distance. I would also like to be able to sort via distance. This is part of a bigger

Hibernate 4.2.20 Object HashCode Method Causing NullPointerException

筅森魡賤 提交于 2021-02-10 03:31:13
问题 I was using Hibernate 4.2.3.FINAL without any issues. When I attempted to upgrade to the latest version 4.2.20.FINAL, I received a NullPointerException when trying to execute a query that loads a list of items. From the stacktrace at the bottom, you can see that my class fails on the hashCode method: com.ovationtix.dao.model.BundledPackageTicket.hashCode(BundledPackageTicket.java:89) This hashCode method looks like this: @Override public int hashCode() { HashCodeBuilder hcb = new

Hibernate 4.2.20 Object HashCode Method Causing NullPointerException

时光毁灭记忆、已成空白 提交于 2021-02-10 03:30:21
问题 I was using Hibernate 4.2.3.FINAL without any issues. When I attempted to upgrade to the latest version 4.2.20.FINAL, I received a NullPointerException when trying to execute a query that loads a list of items. From the stacktrace at the bottom, you can see that my class fails on the hashCode method: com.ovationtix.dao.model.BundledPackageTicket.hashCode(BundledPackageTicket.java:89) This hashCode method looks like this: @Override public int hashCode() { HashCodeBuilder hcb = new