hibernate

Attribute “column”/“type” must be declared for element type “property”

*爱你&永不变心* 提交于 2021-01-27 14:14:42
问题 I am a newbie to hibernate configuration.At my Eclipse project,I am getting the hibernate error above. ERROR: org.hibernate.internal.util.xml.ErrorLogger - HHH000196: Error parsing XML (2) : Element type "hibernate-mapping" must be declared. ERROR: org.hibernate.internal.util.xml.ErrorLogger - HHH000196: Error parsing XML (3) : Element type "class" must be declared. ERROR: org.hibernate.internal.util.xml.ErrorLogger - HHH000196: Error parsing XML (4) : Element type "id" must be declared.

OneToMany with @EmbeddedId and kundera

半城伤御伤魂 提交于 2021-01-27 13:42:00
问题 I have two class and I want to use OneToMany relation with EmbeddedId (Im working with kundera framework) my sensor entity class: public class SensorEntitie implements Serializable { @EmbeddedId private CompoundKey key; @Column private float temperature; @Column private float pressure; @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER) @JoinColumn(name="what I should to put here") private List<PieceEntitie> pieces; } @Embeddable public class CompoundKey { @Column private

hibernate jpa projection with @Query

不问归期 提交于 2021-01-27 13:04:57
问题 Most of the examples I've seen is using entityManager.createQuery or .createNativeQuery etc. Is there a way to have something like the following working? data class SummaryDto(val employeeName: String, val employerName: String) @Query("select e.name as employeeName, emp.name as employerName " + "from Employer e " + "inner join Employee emp on emp.employer_id = e.id ", nativeQuery = true) fun findSummaries(): List<SummaryDto> When I ran the above code I got this error No converter found

hibernate jpa projection with @Query

做~自己de王妃 提交于 2021-01-27 13:00:22
问题 Most of the examples I've seen is using entityManager.createQuery or .createNativeQuery etc. Is there a way to have something like the following working? data class SummaryDto(val employeeName: String, val employerName: String) @Query("select e.name as employeeName, emp.name as employerName " + "from Employer e " + "inner join Employee emp on emp.employer_id = e.id ", nativeQuery = true) fun findSummaries(): List<SummaryDto> When I ran the above code I got this error No converter found

Hibernate and multiThread Logic

不想你离开。 提交于 2021-01-27 10:43:55
问题 Im working on a java standAlone project. I need to use hibernate in a MultiThread application but i just cant figure it out how to set up this correctly. Each Thread deals with the same process of the others. Everything goes Ok when i run it in a Non-Async way, but when i call the same thing using threads, hibernate just don't work fine. Can anyone please explain me what's the correct way to use Hibernate in a multiThread Java Stand-Alone App? Hibernate Util public class HibernateUtil {

Hibernate and multiThread Logic

北慕城南 提交于 2021-01-27 10:43:26
问题 Im working on a java standAlone project. I need to use hibernate in a MultiThread application but i just cant figure it out how to set up this correctly. Each Thread deals with the same process of the others. Everything goes Ok when i run it in a Non-Async way, but when i call the same thing using threads, hibernate just don't work fine. Can anyone please explain me what's the correct way to use Hibernate in a multiThread Java Stand-Alone App? Hibernate Util public class HibernateUtil {

Enum to String conversion during Spring batch import fails

∥☆過路亽.° 提交于 2021-01-27 09:02:35
问题 I'm creating a Spring batch job using Spring Boot and Hiberna but I'm experiencing a problem during the insert. This is the relevant part of the code: @Bean public JdbcBatchItemWriter<OphthalmicLens> writer(DataSource dataSource) throws SQLException { return new JdbcBatchItemWriterBuilder<OphthalmicLens>() .itemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<>()) .sql("INSERT INTO OphthalmicLens (`createdBy`,`createdDate`,`lastModifiedBy`,`lastModifiedDate`,`sid`,

JPA - createEntityManagerFactory returns Null

只谈情不闲聊 提交于 2021-01-27 07:56:59
问题 Noob question here. I'm following this example/tutorial to try and isolate a problem I keep getting on my main project. Problem is, the entityManagerFactory keeps returning null (thus, I get a NullPointerExcept when trying to run the first JUnit test.) I'm currently on Eclipse Indigo (JavaEE) - JRE7 - Hibernate 3.6.7 and JBoss 7 And here's my persistence.xml (again, a copipasta taken right from the tutorial) <persistence> <persistence-unit name="examplePersistenceUnit" transaction-type=

JPA - createEntityManagerFactory returns Null

允我心安 提交于 2021-01-27 07:56:18
问题 Noob question here. I'm following this example/tutorial to try and isolate a problem I keep getting on my main project. Problem is, the entityManagerFactory keeps returning null (thus, I get a NullPointerExcept when trying to run the first JUnit test.) I'm currently on Eclipse Indigo (JavaEE) - JRE7 - Hibernate 3.6.7 and JBoss 7 And here's my persistence.xml (again, a copipasta taken right from the tutorial) <persistence> <persistence-unit name="examplePersistenceUnit" transaction-type=

Hibernate join error: NullPointerException at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement

我的梦境 提交于 2021-01-27 07:53:55
问题 I create this hql in my project (an snack bar), to search all orders that have the product selected by the user as parameter: select order from Order order, OrderItem item inner join order.cod_order_item as item inner join item.cod_product as cod_product where cod_product = id However, when I run the createQuery(), gives a nullpointer at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement. What am i doing wrong? Below, here's my codes: OrderDAO.java public class OrderDAO { private