Package org.hibernate

Examples of org.hibernate.Criteria.createAlias()


        }
        else if (datacenter != null)
        {
            criteria.add(sameDatacenter(datacenter));

            criteria.createAlias(Machine.RACK_PROPERTY, "rack");
            criteria.setProjection(Projections.projectionList()//
                .add(Projections.groupProperty("rack." + PersistentEntity.ID_PROPERTY))//
                .add(Projections.count(PersistentEntity.ID_PROPERTY).as(COUNT_PROJ_NAME)));

            criteria.addOrder(Order.desc(COUNT_PROJ_NAME));
View Full Code Here


    }

    public Machine findByIp(final Datacenter datacenter, final String ip)
    {
        Criteria crit = createCriteria();
        crit.createAlias(Machine.HYPERVISOR_PROPERTY, "hypervisor");

        crit.add(sameDatacenter(datacenter));
        crit.add(Restrictions.eq("hypervisor.ip", ip));

        return (Machine) crit.uniqueResult();
View Full Code Here

        criteria.setFirstResult(startwith);
        criteria.setMaxResults(limit);

        if (user != null)
        {
            criteria.createAlias(VirtualAppliance.VIRTUAL_DATACENTER_PROPERTY, "virtualdatacenter");
            criteria.add(Restrictions.in("virtualdatacenter." + PersistentEntity.ID_PROPERTY,
                availableVdsToUser(user)));
        }

        List<VirtualAppliance> result = getResultList(criteria);
View Full Code Here

        Criteria criteria = null;

        criteria =
            createCriteria().createAlias(AllowedTier.DATACENTER_LIMIT_PROPERTY, LIMIT_ALIAS).add(
                Restrictions.eq(LIMIT_ALIAS + "." + PersistentEntity.ID_PROPERTY, limit.getId()));
        criteria.createAlias(AllowedTier.TIER_PROPERTY, "tier");
        criteria.setProjection(Projections.projectionList()
            .add(Projections.property("tier." + PersistentEntity.ID_PROPERTY))
            .add(Projections.property("tier." + Tier.NAME_PROPERTY))
            .add(Projections.property("tier." + Tier.DESCRIPTION_PROPERTY))
            .add(Projections.property("tier." + Tier.DATACENTER_PROPERTY))
View Full Code Here

    }

    private Criteria criteriaWithStatefulNavigation(final StatefulInclusion stateful)
    {
        Criteria crit = createCriteria();
        crit.createAlias(VirtualMachineTemplate.MASTER_PROPERTY, "ms");
        switch (stateful)
        {
            case USED:
                crit.createAlias(VirtualMachineTemplate.VOLUME_PROPERTY, "vl");
                crit.createAlias("vl." + VolumeManagement.STORAGE_POOL_PROPERTY, "pool");
View Full Code Here

    // without hypervisor
    public List<VirtualMachine> findVirtualMachinesNotAllocatedCompatibleHypervisor(
        final Hypervisor hypervisor)
    {
        Criteria criteria = createCriteria();
        criteria.createAlias(VirtualMachine.VIRTUAL_MACHINE_TEMPLATE_PROPERTY, "template");
        criteria.createAlias(VirtualMachine.VIRTUAL_IMAGE_CONVERSION_PROPERTY, "conversion",
            JoinFragment.LEFT_OUTER_JOIN);
        criteria.createAlias("conversion."
            + VirtualImageConversion.VIRTUAL_MACHINE_TEMPLATE_PROPERTY, "masterconversion",
            JoinFragment.LEFT_OUTER_JOIN);
View Full Code Here

        Criteria crit = createCriteria();
        crit.createAlias(VirtualMachineTemplate.MASTER_PROPERTY, "ms");
        switch (stateful)
        {
            case USED:
                crit.createAlias(VirtualMachineTemplate.VOLUME_PROPERTY, "vl");
                crit.createAlias("vl." + VolumeManagement.STORAGE_POOL_PROPERTY, "pool");
                crit.createAlias("pool." + StoragePool.DEVICE_PROPERTY, "device");
                crit.createAlias("pool." + StoragePool.TIER_PROPERTY, "tier");
                crit.createAlias("vl." + RasdManagement.RASD_PROPERTY, "rasd");
                crit.createAlias("vl." + RasdManagement.VIRTUAL_DATACENTER_PROPERTY, "vdc");
View Full Code Here

    public List<VirtualMachine> findVirtualMachinesNotAllocatedCompatibleHypervisor(
        final Hypervisor hypervisor)
    {
        Criteria criteria = createCriteria();
        criteria.createAlias(VirtualMachine.VIRTUAL_MACHINE_TEMPLATE_PROPERTY, "template");
        criteria.createAlias(VirtualMachine.VIRTUAL_IMAGE_CONVERSION_PROPERTY, "conversion",
            JoinFragment.LEFT_OUTER_JOIN);
        criteria.createAlias("conversion."
            + VirtualImageConversion.VIRTUAL_MACHINE_TEMPLATE_PROPERTY, "masterconversion",
            JoinFragment.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.and(Restrictions.isNull(VirtualMachine.HYPERVISOR_PROPERTY),
View Full Code Here

        crit.createAlias(VirtualMachineTemplate.MASTER_PROPERTY, "ms");
        switch (stateful)
        {
            case USED:
                crit.createAlias(VirtualMachineTemplate.VOLUME_PROPERTY, "vl");
                crit.createAlias("vl." + VolumeManagement.STORAGE_POOL_PROPERTY, "pool");
                crit.createAlias("pool." + StoragePool.DEVICE_PROPERTY, "device");
                crit.createAlias("pool." + StoragePool.TIER_PROPERTY, "tier");
                crit.createAlias("vl." + RasdManagement.RASD_PROPERTY, "rasd");
                crit.createAlias("vl." + RasdManagement.VIRTUAL_DATACENTER_PROPERTY, "vdc");
                crit.createAlias("vl." + RasdManagement.VIRTUAL_APPLIANCE_PROPERTY, "vapp");
View Full Code Here

        switch (stateful)
        {
            case USED:
                crit.createAlias(VirtualMachineTemplate.VOLUME_PROPERTY, "vl");
                crit.createAlias("vl." + VolumeManagement.STORAGE_POOL_PROPERTY, "pool");
                crit.createAlias("pool." + StoragePool.DEVICE_PROPERTY, "device");
                crit.createAlias("pool." + StoragePool.TIER_PROPERTY, "tier");
                crit.createAlias("vl." + RasdManagement.RASD_PROPERTY, "rasd");
                crit.createAlias("vl." + RasdManagement.VIRTUAL_DATACENTER_PROPERTY, "vdc");
                crit.createAlias("vl." + RasdManagement.VIRTUAL_APPLIANCE_PROPERTY, "vapp");
                crit.createAlias("vl." + RasdManagement.VIRTUAL_MACHINE_PROPERTY, "vm");
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.