[
トップ|
一覧|
単語検索|
最終更新|
バックアップ|
ヘルプ]
- 追加された行はこの色です。
- 削除された行はこの色です。
*NEWS
--added LockAcquisitionErrorCodes to MySQL dialect (Jesse Barnum, Emmanuel Bernard)
--added MultipleHiLoPerTableGenerator, one hi value per row/per table (compliant with EJB3)
--added a generator handling multiple hi values per table (Emmanuel Bernard)
--added events for pre/post SQL operation interception
--added experimental support for JACC-aware configuration and events
--added full support for implicit polymorphism in Criteria queries
--added support annotated classes through XML configuration (Emmanuel Bernard)
--added support for WebSphere's weird TxManagerLookup
--added support for filters with dynamic-class mappings
--added support for lists of parameters in filters
--added support for scalar queries in createSQLQuery (Michael Gloegl)
--added support for scalar results in native SQL queries (Michael Gloegl)
--fixed SchemaExport/SchemaUpdate, now respect default_schema and default_catalog (Michael Gloegl)
--fixed a bug in one-to-one mapping with property-ref
--fixed a bug in the query cache lookup routine
--fixed compilation problems on IBM JDK 1.4. and JDK 1.3.1
--fixed custom SQL for loading when using composite identifiers
--fixed exception thrown from optimistic locking failures
--fixed support for limit queries (select first ?) in Informix
--improved SchemaExport/Update, now respect default_schema and default_catalog
--improved dialect handling, throw an exception if no dialect has been set
--improved loading of mappings, no ordering of super/subclasses required anymore
--improved statistics for second-level cache
--improved table generators for hi/lo, can now be used in a JTA environment (Emmanuel Bernard)
--query engine: added support for 'trim([leading | trailing | both] [expression from] expression)'
--query engine: added support for DISTINCT and ALL
--query engine: added support for FETCH
--query engine: added support for HAVING count()
--query engine: added support for HQL NOT IN and EJBQL '[NOT] MEMBER OF'
--query engine: added support for ORDER BY COUNT(*)
--query engine: added support for collections of scalar values
--query engine: added support for literals in constructor select expressions.
--query engine: added support for select elements(..) from Foo f
--query engine: added support for template functions in the SELECT clause
--query engine: fixed NOT LIKE
--query engine: introduced EMPTY and added it to constant (support for IS [NOT] EMPTY)
--updated dom4j, OSCache, EHCache, JBoss Cache, Xerces, Xalan, and Log4j
#amazonkey2(hibernate)
--added a typed exception hierarchy and SQLException converter functionality to the dialects (Steve Ebersole)
--added support for Ant project properties in SchemaExportTask if no config/properties are given (Tim McCune)
--added full support for components in createNativeSQLQuery
--added support for SQL numeric literals als column names
--added support for "select-before-update" for subclass-mappings
--added support for HOLDLOCK on Sybase
--improved handling of long strings (now uses LONG instead of VARCHAR2) on Oracle8 (Harry Schittler)
--improved scalar/projection results, deterministic placement of entities in an Object[] result
--improved setNamingStrategy(), now retuns a Configuration
--improved the unit tests
--improved SchemaUpdate to work around a MySQL metadata bug (Christian Aust)
--improved the Session to throw an exception if a transient object is passed to lock() (Ted Stockwell)
--improve constraint handling for MySQL with SchemaExport/hbm2ddl (Bill Nelson)
--improved Sybase handling, don't fail if columns are duplicated (Jean-Philippe Picou)
--improved support for SunONE application server
--fixed bug in IncrementGenerator, now using quoted table names (Christian Harms)
--fixed transaction handling in TableGenerator (Firebird issue) (Drew Davidson)
--fixed auto-commit mode for SchemaUpdate
--fixed problems with SchemaUpdate and uppercase catalog entries in some DBMS
--fixed various minor problems with SchemaUpdate
--fixed SchemaExportTask, primary key generation for inverse tables (Irfan Mohammed)
--fixed createSQLQuery() to return proper sequenced types when returning multiple entities
--fixed createSQLQuery() to now fully supports components
--fixed cancelLastQuery(), might have canceled pooled statements before (Armin Haaf)
--fixed incorrect SQL for Expression.in() of Criteria (Jason Boutwell)
--fixed a redundant select problem when using the Criteria API and eager fetching (Ohkawa Tomohisa)
--fixed optimistic-lock=dirty strategy for optimistic locking
--fixed mapping defaults, "package" now also works for "extends" class names (Andreas Winter)
--fixed TimestampType.equals on JDK 1.4
--fixed misspelling of configuration property for UUIDGenerator
--fixed a limit query problem with DB2 dialect (Chris Nelson)
--fixed BES transaction manager lookup
--fixed parsing of LocaleType properties
--fixed the cleanup routine of JBoss Cache (query cache issue), updated JBossCache to new version
--fixed defaults for jTDS in hibernate.properties
--fixed problems handling AS and product in SQL formula FROM clause
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);
List list2 =
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();
~
#amazonkey2(JAVA DB)
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.021 sec.