container/profiles/src/main/java/org/mobicents/slee/container/deployment/profile/jpa/JPAProfileEntityFramework.java
public ProfileEntity retrieveProfile(String profileTable, String profileName) {

		if (logger.isTraceEnabled()) {
			logger.trace("retrieveProfile( profileTableName = " + profileTable
					+ " , profileName = " + profileName + " )");
		}

		if (profileName == null) {
			profileName = DEFAULT_PROFILE_NAME;
		}

		EntityManager em = getEntityManager();

		final Query q = em.createQuery(
				"FROM " + profileEntityClassName
						+ " WHERE tableName = ?1 AND profileName = ?2")
				.setParameter(1, profileTable).setParameter(2, profileName);

		if(System.getSecurityManager()==null)
		{
			List<?> resultList = q.getResultList();
			if (resultList.size() > 0) {
				if (logger.isDebugEnabled()) {
					logger.debug("ProfileEntity retrieved -> " + resultList.get(0));
				}
				return (ProfileEntity) resultList.get(0);
			} else {
				return null;
			}
		}else
		{
			return AccessController.doPrivileged(new PrivilegedAction<ProfileEntity>(){

				public ProfileEntity run() {
					List<?> resultList = q.getResultList();
					if (resultList.size() > 0) {
						if (logger.isDebugEnabled()) {
							logger.debug("ProfileEntity retrieved -> " + resultList.get(0));
						}
						return (ProfileEntity) resultList.get(0);
					} else {
						return null;
					}
				}});
		}

	}
public ProfileEntity retrieveProfile(String profileTable, String profileName) {

		if (logger.isTraceEnabled()) {
			logger.trace("retrieveProfile( profileTableName = " + profileTable
					+ " , profileName = " + profileName + " )");
		}

		if (profileName == null) {
			profileName = DEFAULT_PROFILE_NAME;
		}

		EntityManager em = getEntityManager();

		final Query q = em.createQuery(
				"FROM " + profileEntityClassName
						+ " WHERE tableName = ?1 AND profileName = ?2")
				.setParameter(1, profileTable).setParameter(2, profileName);

		if(System.getSecurityManager()==null)
		{
			List<?> resultList = q.getResultList();
			if (resultList.size() > 0) {
				if (logger.isDebugEnabled()) {
					logger.debug("ProfileEntity retrieved -> " + resultList.get(0));
				}
				return (ProfileEntity) resultList.get(0);
			} else {
				return null;
			}
		}else
		{
			return AccessController.doPrivileged(new PrivilegedAction<ProfileEntity>(){

				public ProfileEntity run() {
					List<?> resultList = q.getResultList();
					if (resultList.size() > 0) {
						if (logger.isDebugEnabled()) {
							logger.debug("ProfileEntity retrieved -> " + resultList.get(0));
						}
						return (ProfileEntity) resultList.get(0);
					} else {
						return null;
					}
				}});
		}

	}
/*
(non-Javadoc)

@see
org.mobicents.slee.container.component.profile.ProfileEntityFramework
#retrieveProfile(java.lang.String, java.lang.String)