removed Session wrappers

This commit is contained in:
Timo Westkämper 2012-06-25 08:25:36 +03:00
parent 583bb11078
commit 59b736a966
3 changed files with 0 additions and 136 deletions

View File

@ -1,48 +0,0 @@
/*
* Copyright 2011, Mysema Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.jpa.impl;
import javax.persistence.EntityManager;
import javax.persistence.Query;
/**
* Default implementation of the JPQSessionHolder interface
*
* @author tiwe
*
*/
public class DefaultSessionHolder implements JPASessionHolder{
private final EntityManager entityManager;
public DefaultSessionHolder(EntityManager entityManager){
this.entityManager = entityManager;
}
@Override
public Query createQuery(String queryString) {
return entityManager.createQuery(queryString);
}
@Override
public Query createSQLQuery(String sqlString) {
return entityManager.createNativeQuery(sqlString);
}
@Override
public Query createSQLQuery(String sqlString, Class<?> resultClass) {
return entityManager.createNativeQuery(sqlString, resultClass);
}
}

View File

@ -1,47 +0,0 @@
/*
* Copyright 2011, Mysema Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.jpa.impl;
import javax.persistence.Query;
/**
* @author tiwe
*
*/
public interface JPASessionHolder {
/**
* Create a JPQL query for the given query string
*
* @param queryString
* @return
*/
Query createQuery(String queryString);
/**
* Create an SQL query for the given query string
*
* @param queryString
* @return
*/
Query createSQLQuery(String queryString);
/**
* @param queryString
* @param resultClass
* @return
*/
Query createSQLQuery(String queryString, Class<?> resultClass);
}

View File

@ -1,41 +0,0 @@
/*
* Copyright 2011, Mysema Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.jpa.impl;
import javax.persistence.Query;
/**
* NoSessionHolder is a session holder for detached JPAQuery usage
*
* @author tiwe
*
*/
public class NoSessionHolder implements JPASessionHolder{
@Override
public Query createQuery(String queryString) {
throw new UnsupportedOperationException("No entityManager in detached Query available");
}
@Override
public Query createSQLQuery(String queryString) {
throw new UnsupportedOperationException("No entityManager in detached Query available");
}
@Override
public Query createSQLQuery(String queryString, Class<?> resultClass) {
throw new UnsupportedOperationException("No entityManager in detached Query available");
}
}