JAVA開発メモ
Hibernate のバックアップ差分(No.14)
 

[トップ|一覧|単語検索|最終更新|バックアップ|ヘルプ]





  
  *NEWS

  --added HQL tuple constructor/comparison feature
  --added HQL "fetch all properties" override if instrumentation is used for lazy loading
  --added HQL projection feature, return Lists instead of arrays for projection
  --added HQL projection feature, return Maps with user-defined HQL SELECT aliases as keys
  --added HQL support for expressions in aggregation functions
  --added new IntegrityViolationException to MySQL dialect
  --added value mapping type 'big_integer'
  --added not-found="ignore|exception" switch for legacy associations (i.e. broken database integrity)
  --added fully automatic Session scoping in JTA environments with sf.getCurrentSession()
  --fixed bug in DTD that wouldn't allow union-subclass in separate file
  --fixed a MS SQL Server case sensitivity issue with native SQL queries
  --fixed a minor bug in subselect fetching
  --fixed case sensitivity in HQL functions
  --fixed a bug with listener assignment for save() operation (Matthew Inger)
  --fixed return-property in named SQL queries to work with all identifier names
  --fixed TransactionManager lookup (again) for WAS 6.0
  --fixed a bug with HQL batch delete and MS SQL Server
  --fixed session not getting closed with auto_close when rollback occured
  --improved concatentation handling in AST parser
  --updated dom4j to avoid memory leak in old version
  --updated C3P0

  --added support for autoflush/autoclose to HibernateServiceMBean
  --fixed initialization/session association detection problem of collections
  --fixed creation of FK constraints to union superclass table
  --fixed bug where union-subclass table did not get a PK constraint
  --added a separate log category for HQL parser warnings and errors
  --fixed bulk delete operation on MS SQL Server
  --added support for proxying protected methods (Juozas)
  --added support for unicode quoted strings in new HQL parser
  --fixed implied joins in subselect WHERE clause in new HQL parser
  --added SQLServer7Dialect to handle differences in functions
  --added support for JNDI-bound cache instances, future use for JBoss Cache
  --added scale attribute to column mappings for numeric precision control
  --added fetch=subselect for collections
  --added support for bulk update/delete against discriminator-based inheritence hierarchies
  --added the ability to use naked property refs in HQL (required in update/delete statements)
  --updated CGLIB 2.1.0
  --fixed NPE at BasicEntityPersister.getPropertyIndex (Todd Nine)
  --fixed issue with entity-name and subclasses (Sverker Abrahamsson)
  --fixed issue with correlated subqueries in new HQL parser
  --fixed a problem with native SQL query mapping and embedded composite identifiers
  --improved mapping binding, allowing unordered extends for pure entity-name hiearchies
  --fixed NPE for delete() with deprecated Lifecycle interface
  --fixed a problem with serial joins ending in component value in new HQL parser
  --fixed inner join/subselect precedence problem in new HQL parser
  --fixed indices() function in new HQL parser
  --fixed a bug in InformixDialect, now correct LIMIT clause
  --fixed a bug in idbag.remove() (Sebastien Cesbron)
  --fixed a conflict on OracleDialect between setMaxResult and LockMode.UPGRADE
  --fixed XML configuration file issue with SchemaExport
  --fixed an ArrayIndexOutOfBounds problem
  --renamed executeUpate() to executeUpdate()
  --fixed batch loading for property-ref entities
  --fixed loading from cache of <key property-ref> collection owner
  --fixed minor bug in SQL exception reporting
  --fixed dynamic-component cannot be bound to XML
  --fixed querying component with formula property
  --fixed incorrect table alias for order-by on many-to-many
  --fixed a bug for unidirectional one-to-many with moving child objects
  --fixed a bug with union-subclasses and persister creation
  --fixed a HQL concatenation problem on MySQL
  --fixed a bug where an unnecessary exception was thrown for a property-ref to a superclass property
  --fixed minor dtd bug
  --fixed new bug in Clob/Blob support
  --fixed issue with INDEX_OP and subclass joins on theta-join dialects
  --fixed some minor issues in query cache regions, including HB-1449
  --fixed superflous import and regression bug in verifyparameters
  --fixed two bugs in select id generator (Malcolm Green)
  --fixed increment generator for union-subclass mappings
  --updated JBoss Cache to 1.2.1alpha, fixing locking issues
  --made stat classes serializable
  --fixed merge(), now ignores blob and clob fields
  --added support/dialect for TimesTen
  --improved algorithm for batch fetching, more aggressive
  --improved toStrings()s for Statistics objects (Ryan Lynch)
  --renamed <result-*> to <return-*> for externalized SQL query mapping
  --renamed Session.openSession() for EntityMode to Session.getSession()
  --added support for CASE in HQL
  --fixed bug with filters and polymorphic queries
  --fixed import ordering problem of super/subclass mappings
  --switched to patched ANTLR 2.7.5, now using context classloader before doing class.forname
  --TableHiloGenerator now falls back to TableGenerator properly with max_lo < 2 (Emmanuel Bernard)
  --better transaction handling of TableGenerator in a JTA environment  (Emmanuel Bernard)
  --removed hard coded log4j dependency (Emmanuel Bernard)
  --added support for stored procedure in named queries (Max Andersen)
  --added <property-result> to named SQL queries to allow users to use sql without {}-markup
  --added multi-column property support to native SQL mapping

  --fixed a bad bug in saveOrUpdateCopy() that caused NonUniqueObjectExceptions
  --fixed problems with long types in Oracle DDL generation
  --fixed a memory management problem when deleting collections
  --schema export now uses hibernate.default_schema (Michael Gloegl)
  --fixed broken query cache invalidation from 2.1.7
  --fixed a problem with schema update on some databases
  --support MySQL rlike operator in HQL
  --fixed a minor problem with Hibernate Clobs and Blobs
  --added support for WebSphere's weird TxManagerLookup
  --Add LockAcquisitionErrorCodes to MySQL dialect (Jesse Barnum, Emmanuel Bernard)
  







  

  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();
  
  ~
  #amazonkey2(JAVA DB)
  

トップ 一覧 検索 最終更新 バックアップ   ヘルプ   最終更新のRSS

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.029 sec.