hibernate

Mapping of composite primary keys and foreign keys with shared columns with JPA/Hibernate

早过忘川 提交于 2021-01-27 07:52:59
问题 I've spent a while trying to figure following JPA/Hibernate mapping with composite primary keys and foreign keys (which share 2 of 3 columns), but no joy so far :(. The sample tables follow (yellow key columns comprise PK, blue key columns comprise FK): And so far, I came with the following mapping (which kind of works - it reads data from the database, but can't write any new Party-AdditionalMessage associations because of the updatable=false, insertable-false): ...other imports... import

Mapping of composite primary keys and foreign keys with shared columns with JPA/Hibernate

爱⌒轻易说出口 提交于 2021-01-27 07:50:31
问题 I've spent a while trying to figure following JPA/Hibernate mapping with composite primary keys and foreign keys (which share 2 of 3 columns), but no joy so far :(. The sample tables follow (yellow key columns comprise PK, blue key columns comprise FK): And so far, I came with the following mapping (which kind of works - it reads data from the database, but can't write any new Party-AdditionalMessage associations because of the updatable=false, insertable-false): ...other imports... import

Mapping of composite primary keys and foreign keys with shared columns with JPA/Hibernate

浪尽此生 提交于 2021-01-27 07:49:56
问题 I've spent a while trying to figure following JPA/Hibernate mapping with composite primary keys and foreign keys (which share 2 of 3 columns), but no joy so far :(. The sample tables follow (yellow key columns comprise PK, blue key columns comprise FK): And so far, I came with the following mapping (which kind of works - it reads data from the database, but can't write any new Party-AdditionalMessage associations because of the updatable=false, insertable-false): ...other imports... import

Collate hint on QueryDSL- JPA

拥有回忆 提交于 2021-01-27 07:14:46
问题 There is a way to execute it with QueryDSL? ( bold part ): SELECT * FROM Venue WHERE Name Like '%cafe%' COLLATE Latin1_general_CI_AI I am using JPA with hibernate. 回答1: You can use the addFlag(QueryFlag.Position position, String flag) method, documented here. Something similar to the following should do what you want: query.addFlag(QueryFlag.Position.END, "COLLATE Latin1_general_CI_AI"); In response to your question in the comments, if you require a solution that supports more than one

Collate hint on QueryDSL- JPA

淺唱寂寞╮ 提交于 2021-01-27 07:13:01
问题 There is a way to execute it with QueryDSL? ( bold part ): SELECT * FROM Venue WHERE Name Like '%cafe%' COLLATE Latin1_general_CI_AI I am using JPA with hibernate. 回答1: You can use the addFlag(QueryFlag.Position position, String flag) method, documented here. Something similar to the following should do what you want: query.addFlag(QueryFlag.Position.END, "COLLATE Latin1_general_CI_AI"); In response to your question in the comments, if you require a solution that supports more than one

org.hibernate.HibernateException: No CurrentSessionContext configured

爷,独闯天下 提交于 2021-01-27 06:32:00
问题 Iam using Spring Transactional and AspectJ in my web application. application-context.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http:/

org.hibernate.HibernateException: No CurrentSessionContext configured

别等时光非礼了梦想. 提交于 2021-01-27 06:31:59
问题 Iam using Spring Transactional and AspectJ in my web application. application-context.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http:/

maven dependency tree compile issue in xml-apis

筅森魡賤 提交于 2021-01-27 06:31:57
问题 I'm using hibernate 4.3.0 in a maven project.When I try to run mvn dependacy:tree it shows a compliation issues for xml-apis.jar in dom4j. [INFO] | +- dom4j:dom4j:jar:1.6.1:compile [INFO] | | - xml-apis:xml-apis:jar:1.0.b2:compile If I exclude the xml-apis jar from hibarate-core like below, this issue get solved. <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.0.Final</version> <exclusions> <exclusion> <artifactId>xml-apis</artifactId>

Hibernate native query optional parameter throws 'operator does not exist: bigint = bytea'

南楼画角 提交于 2021-01-27 06:31:37
问题 I have a query as follows: SELECT id FROM table1 WHERE (:param IS NULL OR id_or_smth = :param) The param parameter is optional, therefore it can be null I createed a javax.persistance.Query To which I then setParameter("param", null) And when I called getResultList() I got the following error: Caused by: org.hibernate.exception.SQLGrammarException: ERROR: operator does not exist: bigint = bytea how can i handle this? 回答1: HQL and Criteria can only work when you specify an actual Entity

How to filter a specific exception from Log4j?

你离开我真会死。 提交于 2021-01-27 06:19:56
问题 I'm implementing some new features of Java 8 on my desktop app and Hibernate 3.6 seems to doesn't like it. I added to an Interface a "default method", since then Hibernate it throwing: 2014-10-02 14:01:25,538 WARN entity.PojoEntityTuplizer - could not create proxy factory for:modelo.ChequeTercero org.hibernate.HibernateException: Javassist Enhancement failed: modelo.ChequeTercero at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxyFactory(JavassistLazyInitializer.java:169)