Nhibernate hql bulk update




















Your email address will not be published. Notify me of follow-up comments by email. This site uses Akismet to reduce spam. Learn how your comment data is processed. Vlad Mihalcea. Leave a Comment Posted on August 11, by vladmihalcea. Insert details about how the information is going to be processed. Leave a Reply Cancel reply Your email address will not be published. Find Article Search. Video Course. Hypersistence Optimizer. To execute the non-select operations update, delete, insert also, we need to have the Hibernate Query object.

By calling the executeUpdate method on query object, we can fire the HQL non-select commands. The executeUpdate method returns the rows count. By using the count, we can come to know that, how many records are updated in the database. For all non-select operations insert,update and delete , it is mandatory to begin and commit the transaction.

Going back to the example of joined-subclass, a delete against one of the subclasses may actually result in deletes against not just the table to which that subclass is mapped, but also the "root" table and potentially joined-subclass tables further down the inheritance hierarchy.

Superclass properties are not allowed; and subclass properties do not make sense. Currently, this is checked during query compilation rather than allowing the check to relegate to the database. Note however that this might cause problems between NHibernate Type s which are equivalent as opposed to equal.

This might cause issues with mismatches between a property defined as a NHibernate. DateType and a property defined as a NHibernate. TimestampType , even though the database might not make a distinction or might be able to handle the conversion. For the id property, the insert statement gives you two options.

This later option is only available when using id generators that operate in the database; attempting to use this option with any "in memory" type generators will cause an exception during parsing. Note that for the purposes of this discussion, in-database generators are considered to be NHibernate. SequenceGenerator and its subclasses and any implementors of NHibernate. The most notable exception here is NHibernate. TableHiLoGenerator , which cannot be used because it does not expose a selectable way to get its values.

For properties mapped as either version or timestamp , the insert statement gives you two options. IVersionType is used.

Chapter Batch processing Prev Next. Batch processing. Batch inserts. The StatelessSession interface.



0コメント

  • 1000 / 1000