[
トップ|
一覧|
単語検索|
最終更新|
バックアップ|
ヘルプ]
- 追加された行はこの色です。
- 削除された行はこの色です。
*NEWS
--improved Session serialization support by adding ability to serialize unflushed sessions (Steve Ebersole)
--fixed Session.clear functionality to clear the internal nonExists cache (Steve Ebersole)
--added "dynamic instantiation" (i.e., select new foo() ...) support to ScrollableResultsImpl and IteratorImpl (Steve Ebersole)
--added support for multi-parameter SQL functions (Steve Ebersole)
--fixed hbm2ddl generating infinite indexes on MySQL (Michael Gloegl)
--fixed alias precedence in HQL queries, function names are second (Steve Ebersole)
--added "transactional" as allowed cache concurrency strategy in XML configuration file
--improved System.getProperties() with security exception warning in secure environments
--improved Proxool integration, better property handling
--fixed problem with use of getDefinedMethod() in secure environments (Ken Arnold)
--fixed bug in createSQLQuery() which prohibited multiple aliases for the same entity (Max Andersen)
--fixed query cache misses when using named bind parameters (Michael Greer)
--recognize "left" and "right as keywords in SQL fragments
--recognize SQL quoted identifiers in SQL fragments
--improved identity handling on SQL Server by using scope_identity() for update counts (Arthur Fitt)
--added DB2390Dialect for DB2/390 databases (Kristoffer Dyrkorn)
--fixed a bug in toArray() of identifier bag collections (Khachchou Mohammed)
--fixed a problem with DDL generation for serial columns in Informix
--fixed a problem with DDL generation for timestamp columns in Informix (Michael Schmidt)
--fixed a NPE that occurred calling saveOrUpdateCopy() for components
--fixed a bug with replicate() and uninitialized collections
--fixed a bug caching one-to-one associations
--fixed eviction from named query cache regions
--fixed erroneous association access when calling saveOrUpdateCopy() (David Wright)
--fixed JCA handling of the JDBC connection (Attila Lendvai)
--fixed ordering of selected columns in fetching code (for Oracle)
--fixed a bug in Criteria.setLockMode()
--fixed a minor bug where refresh() caused a CGLIB exception if a proxy interface was enabled (George Svarovsky)
--fixed a minor bug where Interceptor.onLoad() received empty collections after cache lookups (Mark Rohan)
--fixed a null pointer when setting null parameters without a type
--fixed result pagination (setFirst/MaxResult) on Oracle 8.1.x (Aeros Lau)
--fixed generation of LONG/RAW columns on Oracle9 (Brett Lawrence)
--fixed a minor issue with SchemaExport on latest MySQL versions (Koen Janssens)
--fixed a minor bug in Ingres dialect (Brad Beck)
--fixed DBCP configuration property parsing to avoid NullPointerException (Henning Schmiedehausen)
--fixed subclassing of CollectionPersister (Kelley Stover)
--fixed automatic ID generation for collection-id generators (Thompson Marzagao)
--fixed JBoss deployment issues by moving JBoss hibernate-service.xml to etc/ directory
--fixed documentation example of HibernateUtil class (Christian Bauer)
--improved serialization of object graphs with javax.beans.XMLEncoder (Alexander Thomas)
--improved configuration loading for Proxool (use "file:" or classloader resource loading), see HB-1048 (Aleksei Gopachenko)
--improved QueryCache interface, now pluggable via hibernate.cache.query_cache_factory (Steve Ebersole)
--improved scroll() query method, now the entire entity is populated from the initial result set (Steve Ebersole)
--improved XML serialization/deserialization for binary and timestamp types (Stefano Travelli)
--added support for enabling batching of versioned data (configurable)
--added cache region property to JMX MBean interface (Arnaud Barbe)
--added 'distinct' as allowed keyword in metadata declared SQL
--added setForceCacheRefresh() on Query for fine-grained eviction without individual cache regions (Shamir Karkal)
--added support for sequences on Informix
--added support for identity columns on DB2/400 (Andre Oosthuizen)
--added EhCache provider to Hibernate distribution, use net.sf.hibernate.cache.EhCacheProvider (Emmanuel Bernard)
--added TransactionManagerLookup for Borland Enterprise Server (Etienne Hardy)
--added support for index attribute on <property/>, <many-to-one/>, and <any/> elements
--updated EHCache to version 0.9
--updated commons libraries with compatibility for commons-collections 3.0
--updated to JBossCache 1.02 and JGroups 2.2.3, didn't test SwarmCache
DB2,FrontBase,HSQLDB,informix,interbase,MS SQL server,MySQL, Oracle,Pointbase,PostgreSQL,Sybase etc.
-[[Working with Hibernate in Eclipse:http://www.onjava.com/pub/a/onjava/2004/06/23/hibernate.html]]
package test;
import java.util.List;
import java.util.Properties;
import net.sf.hibernate.Hibernate;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;
import net.sf.hibernate.cfg.Configuration;
import net.sf.hibernate.expression.Expression;
public class SampleMain {
public static void main(String[] args) {
Configuration cfg = null;
Session session = null;
Transaction transaction = null;
Properties props = new Properties();
try {
cfg = new Configuration().addClass(Person.class).addProperties(props);
session = cfg.buildSessionFactory().openSession();
//session.setFlushMode(FlushMode.COMMIT);
transaction = session.beginTransaction();
Person person = new Person();
Long id = (Long) session.save(person);
Person load = (Person) session.load(Person.class, id);
System.out.println(load);
session.update(person);
List list = session.find("from Person where id=?", id, Hibernate.LONG);
System.out.println(list);
List list2 =
session.createCriteria(Person.class).add(Expression.eq("id", id)).list();
System.out.println(list2);
session.delete(person);
list = session.find("from Person");
System.out.println(list);
transaction.commit();
} catch (Exception e) {
try {
if (transaction != null)
transaction.rollback();
} catch (Exception e1) {
e1.printStackTrace();
}
e.printStackTrace();
} finally {
try {
if (session != null && session.isOpen())
session.close();
} catch (HibernateException e1) {
e1.printStackTrace();
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="test.Person" table="PERSON">
<id name="id" column="ID" type="long">
<generator class="native"/>
</id>
<property name="name" column="NAME" type="string" length="20" not-null="true"/>
</class>
</hibernate-mapping>
Person load = (Person) session.load(Person.class, id, LockMode.UPGRADE);
List list2 = session.createCriteria(Person.class)
.add(Expression.eq("id", id))
.setLockMode(LockMode.UPGRADE)
.list();
Modified by MT22(Moriwaki Takashi)
"PukiWiki" 1.3.7 Copyright © 2001,2002,2003 PukiWiki Developers Team. License is GNU/GPL.
Based on "PukiWiki" 1.3 by sng
Powered by PHP 7.4.33
HTML convert time to 0.028 sec.