Package javax.persistence.spi

Examples of javax.persistence.spi.LoadState


   
    @Test
    public void testIsLoaded()
    {
        KunderaPersistenceProviderUtil providerUtil = new KunderaPersistenceProviderUtil(persistence);
        LoadState state = providerUtil.isLoaded(null);
        Assert.assertNotNull(state);
        Assert.assertEquals(LoadState.NOT_LOADED, state);
    }
View Full Code Here


    public void testIsLoadedWithOutReference()
    {
        KunderaPersistenceProviderUtil providerUtil = new KunderaPersistenceProviderUtil(persistence);
        Person p = new Person();
        p.setAge(32);
        LoadState state = providerUtil.isLoadedWithoutReference(p,"age");
        Assert.assertNotNull(state);
        Assert.assertEquals(LoadState.LOADED, state);
    }
View Full Code Here

    public void testIsLoadedWithReference()
    {
        KunderaPersistenceProviderUtil providerUtil = new KunderaPersistenceProviderUtil(persistence);
        Person p = new Person();
        p.setAge(32);
        LoadState state = providerUtil.isLoadedWithReference(p,"age");
        Assert.assertNotNull(state);
        Assert.assertEquals(LoadState.UNKNOWN, state);
    }
View Full Code Here

    }

    @Override
    public boolean isLoaded(Object entity, String attributeName)
    {
        LoadState state = PersistenceUtilHelper.isLoadedWithoutReference(entity, attributeName, this.cache);
        if (state == LoadState.LOADED)
        {
            return true;
        }
        if (state == LoadState.NOT_LOADED)
View Full Code Here

        }

        @Override
        public boolean isLoaded(Object entity, String attributeName)
        {
            LoadState state = PersistenceUtilHelper.isLoadedWithoutReference(entity, attributeName, this.cache);
            if (state == LoadState.LOADED)
            {
                return true;
            }
            if (state == LoadState.NOT_LOADED)
View Full Code Here

            // Find entity
            em = emf.createEntityManager();
            Photographer p = em.find(Photographer.class, 1);
            Album album2 = p.getAlbum();
            // Load state before field referred
            LoadState loadStateWithReference = util.isLoadedWithReference(album2, "albumName");
            // UNKNOWN because PROXY initialization currently not implemented in
            // Kundera
            Assert.assertEquals(LoadState.UNKNOWN, loadStateWithReference);

            // Load state after field referred
View Full Code Here

            Album album2 = p.getAlbum();

            // Load state before field referred
            // Loaded because LAZY initialization currently not implemented in
            // Kundera
            LoadState loadStateWithoutReference = util.isLoadedWithoutReference(album2, "albumName");
            Assert.assertEquals(LoadState.NOT_LOADED, loadStateWithoutReference);

            // Load state after field referred
            album2.getAlbumName();
            loadStateWithoutReference = util.isLoadedWithoutReference(p, "album");
View Full Code Here

            em = emf.createEntityManager();
            Photographer p = em.find(Photographer.class, 1);
            Album album2 = p.getAlbum();

            // Load state before field referred
            LoadState loadState = util.isLoaded(album2);
            Assert.assertEquals(LoadState.NOT_LOADED, loadState);

            // Load state after field referred
            album2.getAlbumName();
            loadState = util.isLoaded(album2);
View Full Code Here

                // Iterate through the list using ProviderUtil.isLoadedWithoutReference()
                for (PersistenceProvider pp : pps) {
                    try {
                        ProviderUtil pu = pp.getProviderUtil();
                        LoadState ls = pu.isLoadedWithoutReference(entity, attributeName);
                        if (ls == LoadState.LOADED)
                            return true;
                        if (ls == LoadState.NOT_LOADED)
                            return false;
                    }
                    catch (Throwable t) {
                        // JPA 1.0 providers will not implement the getProviderUtil
                        // method.  Eat the exception and try the next provider.
                    }
                 }
                // Iterate through the list a second time using ProviderUtil.isLoadedWithReference()
                for (PersistenceProvider pp : pps) {
                    try {
                        ProviderUtil pu = pp.getProviderUtil();
                        LoadState ls = pu.isLoadedWithReference(entity, attributeName);
                        if (ls == LoadState.LOADED)
                            return true;
                        if (ls == LoadState.NOT_LOADED)
                            return false;
                    }
View Full Code Here

                // Iterate through the list of providers, using ProviderUtil to
                // determine the load state
                for (PersistenceProvider pp : pps) {
                    try {
                        ProviderUtil pu = pp.getProviderUtil();
                        LoadState ls = pu.isLoaded(entity);
                        if (ls == LoadState.LOADED)
                            return true;
                        if (ls == LoadState.NOT_LOADED)
                            return false;
                        // Otherwise, load state is unknown.  Query the next provider.
View Full Code Here

TOP

Related Classes of javax.persistence.spi.LoadState

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.