Examples of HibernateCallback


Examples of org.springframework.orm.hibernate.HibernateCallback

  /* (non-Javadoc)
   * @see com.apress.prospring.data.EntryDao#getMostRecent(int)
   */
  public List getMostRecent(final int count) {
    return (List) getHibernateTemplate().execute(new HibernateCallback() {

      public Object doInHibernate(Session session) throws HibernateException, SQLException {
        Query query = session.createQuery("from Entry");
        query.setMaxResults(count);
        return query.list();
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateCallback

  public void testHibernateIntegration() {
    hibernateTransactionTemplate.execute(new TransactionCallback() {
      public Object doInTransaction(TransactionStatus status) {
        // Testing access through HibernateTemplate
        Hotel hotel = (Hotel)getHibernateTemplate().execute(new HibernateCallback() {
          public Object doInHibernate(org.hibernate.Session session) throws HibernateException, SQLException {
            return getFirstHotel(session);
          }
        });
        hotel.setName(HIBERNATE_HOTEL_NAME);
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateCallback

    /**
     * Batch Update in HQL
     * http://www.hibernate.org/hib_docs/reference/en/html/batch.html#batch-direct
     */
    public void incrementSchoolPopularity(final School school) {
        getHibernateTemplate().execute(new HibernateCallback() {
            public Object doInHibernate(Session session)
                    throws HibernateException, SQLException {

                String hql = "update School set popularityCounter = popularityCounter + 1 where id = :id";
                int updated = session.createQuery(hql).setLong("id",
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateCallback

    try {
      // use the hibernateTemplate is present and if needed
      if (hibernateTemplate != null && hasPersistenceService) {

        // use hibernate template
        return hibernateTemplate.execute(new HibernateCallback() {
          /**
           * @see org.springframework.orm.hibernate3.HibernateCallback#doInHibernate(org.hibernate.Session)
           */
          public Object doInHibernate(Session session) throws HibernateException, SQLException {
            // inject the session in the context
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateCallback

    if (existingTransaction) {
      logger.debug("Found thread-bound Session for JbpmTemplate");
    }

    try {
      return hibernateTemplate.execute(new HibernateCallback() {
        /**
         * @see org.springframework.orm.hibernate3.HibernateCallback#doInHibernate(org.hibernate.Session)
         */
        public Object doInHibernate(Session session) throws HibernateException, SQLException {
          return callback.doInJbpm(jbpmSession);
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateCallback

    /**
     * @see no.ugland.utransprod.dao.SumOrderReadyVDAO#findByDate(java.lang.String)
     */
    public SumOrderReadyV findByDate(final String dateString) {
        return (SumOrderReadyV) getHibernateTemplate().execute(new HibernateCallback() {

            @SuppressWarnings("unchecked")
            public Object doInHibernate(Session session) throws HibernateException {
                List<SumOrderReadyV> list = session.createCriteria(SumOrderReadyV.class).add(
                        Restrictions.eq("sumOrderReadyVPK.orderReady", dateString)).list();
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateCallback

    /**
     * @see no.ugland.utransprod.dao.SumOrderReadyVDAO#findSumByWeek(java.lang.Integer,
     *      java.lang.Integer)
     */
    public SumOrderReadyV findSumByWeek(final Integer year, final Integer week) {
        return (SumOrderReadyV) getHibernateTemplate().execute(new HibernateCallback() {

            @SuppressWarnings("unchecked")
            public Object doInHibernate(Session session) throws HibernateException {
                List<SumOrderReadyV> list = session.createCriteria(SumOrderReadyV.class).add(
                        Restrictions.eq("orderReadyYear", year)).add(Restrictions.eq("orderReadyWeek", week))
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateCallback

     * @see no.ugland.utransprod.dao.SumOrderReadyVDAO#findByDateAndProductAreaGroupName(java.lang.String,
     *      java.lang.String)
     */
    public SumOrderReadyV findByDateAndProductAreaGroupName(final String dateString,
            final String productAreaGroupName) {
        return (SumOrderReadyV) getHibernateTemplate().execute(new HibernateCallback() {

            @SuppressWarnings("unchecked")
            public Object doInHibernate(Session session) throws HibernateException {
                List<SumOrderReadyV> list = session.createCriteria(SumOrderReadyV.class).add(
                        Restrictions.eq("sumOrderReadyVPK.orderReady", dateString)).add(
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateCallback

     * @see no.ugland.utransprod.dao.SumOrderReadyVDAO#findSumByWeekAndProductAreaGroupName(java.lang.Integer,
     *      java.lang.Integer, java.lang.String)
     */
    public SumOrderReadyV findSumByWeekAndProductAreaGroupName(final Integer year, final Integer week,
            final String productAreaGroupName) {
        return (SumOrderReadyV) getHibernateTemplate().execute(new HibernateCallback() {

            @SuppressWarnings("unchecked")
            public Object doInHibernate(Session session) throws HibernateException {
                List<SumOrderReadyV> list = session.createCriteria(SumOrderReadyV.class).add(
                        Restrictions.eq("orderReadyYear", year)).add(Restrictions.eq("orderReadyWeek", week))
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateCallback

  /**
   * @see no.ugland.utransprod.dao.ContactDAO#findAllTilAvrop(java.lang.Integer)
   */
  @SuppressWarnings("unchecked")
  public List<Contact> findAllTilAvrop(final Integer category) {
    return getHibernateTemplate().executeFind(new HibernateCallback() {

      public Object doInHibernate(Session session)
          throws HibernateException {
        return session.createCriteria(Contact.class).add(
            Restrictions.eq("categoryIdx", category)).list();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.