Package org.hibernate

Examples of org.hibernate.Criteria.createAlias()


    public List<Store> findStoresByRetailerId(final Long retailerId, Object... params) {
        Criteria criteria = createDefaultCriteria(Store.class);

        handleSpecificStoreFetchMode(criteria, params);

        criteria.createAlias("retailer", "retailer", JoinType.LEFT_OUTER_JOIN);
        criteria.add( Restrictions.eq("retailer.id", retailerId));

        criteria.addOrder(Order.asc("name"));

        @SuppressWarnings("unchecked")
View Full Code Here


    public List<Store> findStoresByRetailerCode(final String retailerCode, Object... params) {
        Criteria criteria = createDefaultCriteria(Store.class);

        handleSpecificStoreFetchMode(criteria, params);

        criteria.createAlias("retailer", "retailer", JoinType.LEFT_OUTER_JOIN);
        criteria.add( Restrictions.eq("retailer.code", retailerCode));
       
        criteria.addOrder(Order.asc("name"));

        @SuppressWarnings("unchecked")
View Full Code Here

                        Restrictions.and(
                                Restrictions.in(direction, entities),
                                Restrictions.not(Restrictions.in(oppositeDirection, entities))
                        )
                );
                invocationQuery.createAlias("from", "f");
                invocationQuery.createAlias("to", "t");

                invocationQuery.add(
                        Restrictions.and(
                                Restrictions.isNotNull("f.parent"),
View Full Code Here

                                Restrictions.in(direction, entities),
                                Restrictions.not(Restrictions.in(oppositeDirection, entities))
                        )
                );
                invocationQuery.createAlias("from", "f");
                invocationQuery.createAlias("to", "t");

                invocationQuery.add(
                        Restrictions.and(
                                Restrictions.isNotNull("f.parent"),
                                Restrictions.isNotNull("t.parent")
View Full Code Here

    public List<AbstractFamixEntity> queryEntitiesBySourceReference(Hashtable<String,Integer> sourceReferences) throws EvolizerException {
        List<AbstractFamixEntity> entities = new ArrayList<AbstractFamixEntity>();

        try {
            Criteria query = getHibernateSession().createCriteria(AbstractFamixEntity.class);
            query.createAlias("sourceAnchor", "sa");
            Disjunction orClausel = Restrictions.disjunction();

            int countOPs = 0;
            for (String reducedUniqueName : sourceReferences.keySet()) {
                if (reducedUniqueName != "") {
View Full Code Here

    public List<RasdManagement> findDisksAndVolumesByVirtualMachine(
        final VirtualMachine virtualMachine)
    {
        Criteria crit = createCriteria();
        crit.createAlias(RasdManagement.RASD_PROPERTY, "rasd");

        // Add disk resource type filter
        crit.add(Restrictions.in(RasdManagement.ID_RESOURCE_TYPE_PROPERTY, new String[] {
        VolumeManagement.DISCRIMINATOR, DiskManagement.DISCRIMINATOR}));
View Full Code Here

    }

    public List<Machine> findMachinesWithHAInProgress()
    {
        Criteria criteria = createCriteria(sameState(MachineState.HA_IN_PROGRESS));
        criteria.createAlias(Machine.HYPERVISOR_PROPERTY, "hypervisor");

        // Order by name
        criteria.addOrder(Order.asc(Machine.NAME_PROPERTY));

        return getResultList(criteria);
View Full Code Here

        if (rack instanceof UcsRack)
        {
            return findRackEnabledForHAMachinesInUcs((UcsRack) rack);
        }
        Criteria criteria = createCriteria(sameRack(rack));
        criteria.createAlias(Machine.HYPERVISOR_PROPERTY, "hypervisor");

        // Is a managed one
        criteria.add(Restrictions.in(Machine.STATE_PROPERTY, new Object[] {MachineState.MANAGED,
        MachineState.STOPPED, MachineState.PROVISIONED}));
View Full Code Here

    }

    public List<Machine> findRackEnabledForHAMachinesInUcs(final UcsRack rack)
    {
        Criteria criteria = createCriteria(sameRack(rack));
        criteria.createAlias(Machine.HYPERVISOR_PROPERTY, "hypervisor");

        // Is a managed one
        criteria.add(Restrictions.eq(Machine.STATE_PROPERTY, MachineState.MANAGED));

        // XenServer does not support HA
View Full Code Here

    private Long numPossibleAvailableMachines(final Enterprise enterprise, final Rack rack,
        final Datacenter datacenter, final HypervisorType hypervisorType,
        final List<Integer> bannedMachineIds)
    {
        Criteria criteria = getSession().createCriteria(Machine.class);
        criteria.createAlias(Machine.HYPERVISOR_PROPERTY, "hypervisor");

        if (!CollectionUtils.isEmpty(bannedMachineIds))
        {
            criteria.add(Restrictions.not(Restrictions.in(PersistentEntity.ID_PROPERTY,
                bannedMachineIds)));
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.