hibernate
文章平均质量分 53
qq_31230529
这个作者很懒,什么都没留下…
展开
-
Hibernate – One-to-One example (Annotation)
In this tutorial, it will reuse the entire infrastructure of the previous “Hibernate one to one relationship example – XML mapping” tutorial, enhance it to support Hibernate / JPA annotation.Project St转载 2015-09-16 14:18:04 · 219 阅读 · 0 评论 -
Spring管理Hibernate事务
1、TransactionProxyFactoryBean<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://转载 2015-09-21 16:42:31 · 213 阅读 · 0 评论 -
org.hibernate.HibernateException: save is not valid without active transaction
I am creating JSF application and using some hibernate stuff in it. All I want to do is to save the entity into the database but I keep getting this exception:org.hibernate.HibernateException: save is转载 2015-09-21 13:41:59 · 1283 阅读 · 0 评论 -
Hibernate SessionFactory getCurrentSession is not valid without active transaction
I am facing one problem in Hibernate. Here is the code. Configuration cfg = new Configuration().configure(); SessionFactory factory = cfg.buildSessionFactory(); Session session = factory.ope转载 2015-09-21 13:23:18 · 612 阅读 · 0 评论 -
Spring AOP transaction management in Hibernate
Transaction management is required to ensure the data integrity and consistency in database. Spring’s AOP technique is allow developers to manage the transaction declarative.Here’s an example to show h转载 2015-09-21 16:20:15 · 297 阅读 · 0 评论 -
Hibernate Criteria 多层次查询关联问题
hibernate存在如下表及关联: class House{ private string houseid; private string housename; } class Shelf{ private string shelfid; private House house; } class Position{ private strin转载 2015-09-22 13:08:12 · 399 阅读 · 0 评论 -
PROPAGATION_REQUIRED事务管理
PROPAGATION_REQUIRED事务采用编程式事务 1、 getCurrentSession()与openSession()的区别?采用getCurrentSession()创建的session会绑定到当前线程中,而采用openSession()创建的session则不会采用getCurrentSession()创建的session在commit或rollback时会自动关闭,而采用o转载 2015-09-21 14:07:20 · 1483 阅读 · 0 评论 -
Spring with Hibernate persistence and transactions example
In this tutorial you will learn how to implement Hibernate persistence using the Spring framework in a transactional fashion.IntroductionAfter reading this tutorial you will be able to implement Hibern转载 2015-09-21 15:56:32 · 279 阅读 · 0 评论 -
getCurrentSession hibernate in web
I am writing a web based application with hibernate and jsp/servlet. I have read about the sessionFactory.getCurrentSession and sessionFactory.openSession methods. I know the basic difference between t转载 2015-09-21 13:36:12 · 225 阅读 · 0 评论 -
Different between session.get() and session.load()
Often times, you will notice Hibernate developers mix use of session.get() and session.load(), do you wonder what’s the different and when you should use either of it?Different between session.get() an转载 2015-09-22 12:54:06 · 267 阅读 · 0 评论 -
HibernateTransactionManager事务管理
配置JdbcTemplate:先配置数据源: <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver" />转载 2015-09-21 17:31:01 · 935 阅读 · 0 评论 -
How to Identify and Resolve Hibernate N+1 SELECT's Problems
Let’s assume that you’re writing code that’d track the price of mobile phones. Now, let’s say you have a collection of objects representing different Mobile phone vendors (MobileVendor), and each vendo转载 2015-09-18 12:33:17 · 221 阅读 · 0 评论 -
Hibernate: Understanding Lazy Fetching
The Good, The Bad, and The UglyOne of the potential problems with object/relational mapping is that a lot of work has to be done to convert relational results into object results. Because of the nature转载 2015-09-18 16:54:46 · 355 阅读 · 0 评论 -
Hibernate Eager vs Lazy Fetch Type
BackgroundThe topic of Fetch types in Hibernate is a fairly advanced topic, as it requires you to have a decent understanding of the Java programming language, as well as have had exposure to SQL and t转载 2015-09-18 14:07:27 · 358 阅读 · 0 评论 -
Hibernate – fetching strategies examples
Hibernate has few fetching strategies to optimize the Hibernate generated select statement, so that it can be as efficient as possible. The fetching strategy is declared in the mapping relationship to转载 2015-09-18 13:54:41 · 218 阅读 · 0 评论 -
Hibernate – One-to-One example (XML Mapping)
A one-to-one relationships occurs when one entity is related to exactly one occurrence in another entity. In this tutorial, we show you how to work with one-to-one table relationship in Hibernate, via转载 2015-09-16 14:11:39 · 210 阅读 · 0 评论 -
@Transactional in Spring+Hibernate
I an using Spring 3.1 + Hibernate 4.x in my web application. In my DAO, i am saving User type object as followingsessionFactory.getCurrentSession().save(user);But getting following exception:org.hibern转载 2015-09-21 14:59:54 · 248 阅读 · 0 评论