spring-orm

Hibernate @Version annotation

[亡魂溺海] 提交于 2021-02-16 18:12:08
问题 What is the relation between hibernate @version and ManyToOne Mapping. Assume that i am having two tables Department and Employee. Here is Deparment is the master table and Employee in the detail table. In the Employee table, departmentID is reference as foreign key. Here is my classes Public class Department { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long ID; @Version private Long version; //Getters and Setters } public class Employee { @Id @GeneratedValue(strategy =

No support for iBatis in Spring4.2.0

99封情书 提交于 2021-02-07 14:43:43
问题 There is no support for ibatis in Spring4.2.0. MY project is upgrading from Spring 3.2.4 to Spring 4.2. As i googled, i found spring4.2 integration examples with mybatis but not with ibatis. Can somebody help me on how i can add ibatis support? 回答1: iBATIS 2.x support was removed from Spring in version 4.0 but there is a workaround for that. See this post: http://blog.mybatis.org/2015/11/spring-4-got-you-down-with-no-ibatis.html Basically you just have to add this dependency to your project:

No support for iBatis in Spring4.2.0

纵然是瞬间 提交于 2021-02-07 14:40:37
问题 There is no support for ibatis in Spring4.2.0. MY project is upgrading from Spring 3.2.4 to Spring 4.2. As i googled, i found spring4.2 integration examples with mybatis but not with ibatis. Can somebody help me on how i can add ibatis support? 回答1: iBATIS 2.x support was removed from Spring in version 4.0 but there is a workaround for that. See this post: http://blog.mybatis.org/2015/11/spring-4-got-you-down-with-no-ibatis.html Basically you just have to add this dependency to your project:

org.hibernate.WrongClassException on saving an entity via Hibernate

拟墨画扇 提交于 2019-12-31 03:33:06
问题 In this question I am working with Hibernate 4.3.4.Final and Spring ORM 4.1.2.RELEASE. I have an User class, that holds a Set of CardInstances like this: @Entity @Table public class User implements UserDetails { protected List<CardInstance> cards; @ManyToMany public List<CardInstance> getCards() { return cards; } // setter and other members/methods omitted } @Table @Entity @Inheritance @DiscriminatorColumn(name = "card_type", discriminatorType = DiscriminatorType.STRING) public abstract class

Duplicate entry exception hibernate

此生再无相见时 提交于 2019-12-24 12:35:11
问题 I'm having some issues storing entries into my database. I am using the following heirarchy: I have a parent class PageContent and two subclasses TextEntry and Image however when I try to store more than PageContent entity I get the following exception: HTTP Status 500 - Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: Duplicate entry '2' for key 'groups_groupId'; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception

Dynamically changing session factory and Txm Manager for I18N support

≡放荡痞女 提交于 2019-12-24 10:36:58
问题 I have a peculiar issue here in the Spring-GWT application we are building. We have an oracle DB encoded in WE8ISO8859P1 character set which doesn't support UTF-8 . Hence we are building a new DB in AL32UTF8 char set . Unfortunately the DBAs do not want to migrate the existing DB to the new DB and we have to reach the old DB for the English data and the new DB for the Latin data . We have @Transactional annotations at method/class level and the sessionFactory is injected into the DAO to

No transaction in progress exception with Spring 3.1 and JPA 2

二次信任 提交于 2019-12-22 08:39:38
问题 I have been at this for weeks. I have tried eclipselink and now just plain JPA. I keep getting the same issue. Everytime I try to flush my entity manager I get 'javax.persistence.TransactionRequiredException: no transaction is in progress' exception. I know its something to do with how I have everything wired but I can't figure it out. I have tried writing JUnit tests to test, but since I am new to spring that has a entirely different set of issue. Some things to note: I am not using a