Package net.sf.myway.hibernate

Examples of net.sf.myway.hibernate.HibernateUtil


            parent.addChild(r);
          }
        }
        monitor.worked(2);
        monitor.setTaskName(Messages.NewRegionWizard_SaveRegion);
        final HibernateUtil con = HibernateActivator.getDefault().getConnection();
        con.persist(r);
      }
    });
  }
View Full Code Here


    if (!_selection.isEmpty() && _selection instanceof IStructuredSelection) {
      final Object f = ((IStructuredSelection) _selection).getFirstElement();
      if (f instanceof Region)
        r.setParent((Region) f);
    }
    final HibernateUtil con = HibernateActivator.getDefault().getConnection();
    monitor.worked(2);
    monitor.setTaskName(Messages.NewRegionWizard_SaveRegion);
    con.runTransaction(new DBAction() {
      @Override
      public void run(final Session session) {
        // FIXME can be right
        final Region er = new Region();
        session.persist(er);
View Full Code Here

  /**
   * @see net.sf.myway.map.da.MapDA#delete(net.sf.myway.map.da.entities.MapObject)
   */
  @Override
  public void delete(final MapObject obj) {
    final HibernateUtil con = getCon();
    final List<MapNodeRef> nodes = obj.getNodes();
    final List<Object> toDel = new ArrayList<Object>();
    for (final MapNodeRef ref : nodes) {
      toDel.add(ref);
      ref.setNode(null);
    }
    obj.setNodes(null);
    toDel.add(obj);
    con.delete(toDel);
  }
View Full Code Here

   * @see net.sf.myway.map.da.MapDA#getObjects(double, double, double, double)
   */
  @Override
  public List<MapObject> getObjects(final double longMin, final double longMax,
    final double latMin, final double latMax) {
    final HibernateUtil con = getCon();
    return con.getList("from " + MapObject.class.getName()
      + " o where (o.boundingBox.east.val >= ? and o.boundingBox.west.val <= ?) and"
      + " (o.boundingBox.north.val >= ? and o.boundingBox.south.val <= ?)", longMin, longMax,
      latMin, latMax);
  }
View Full Code Here

  /**
   * @see net.sf.myway.map.da.MapDA#save(net.sf.myway.map.da.entities.MapObject)
   */
  @Override
  public void save(final MapObject... object) {
    final HibernateUtil con = getCon();
    con.runTransaction(new DBAction() {
      @Override
      public void run(final Session session) {
        for (final MapObject obj : object)
          if (obj.getId() == null)
            session.persist(obj);
View Full Code Here

   * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
   */
  @Override
  public boolean performOk() {
    final boolean res = super.performOk();
    final HibernateUtil con = HibernateActivator.getDefault().getConnection();
    con.close();
    con.configConnection();
    return res;
  }
View Full Code Here

TOP

Related Classes of net.sf.myway.hibernate.HibernateUtil

Copyright © 2018 www.massapicom. 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.