All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jk.data.vendors.hibernate.JKEntityManagerFactory Maven / Gradle / Ivy

Go to download

This contains a set of API's that ease the database programming with Java, in both: JDBC and JPA Persisitnce).

There is a newer version: 7.0.0-M7
Show newest version
/*
 * Copyright 2002-2021 Dr. Jalal Kiswani. 
 * Email: [email protected]
 * Check out https://smart-api.com for more details
 * 
 * All the opensource projects of Dr. Jalal Kiswani are free for personal and academic use only, 
 * for commercial usage and support, please contact the author.
 *
 * 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.jk.data.vendors.hibernate;

import javax.persistence.EntityManagerFactory;
import javax.persistence.spi.PersistenceUnitInfo;

import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl;
import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor;

// TODO: Auto-generated Javadoc
/**
 * A factory for creating JKEntityManager objects.
 */
public class JKEntityManagerFactory {

	/**
	 * Creates a new JKEntityManager object.
	 *
	 * @param info the info
	 * @return the entity manager factory
	 */
	public static EntityManagerFactory createEntityManagerFactory(PersistenceUnitInfo info) {

		// Map integrationSettings = new HashMap<>();
		// integrationSettings.put(AvailableSettings.INTERCEPTOR, new
		// JKCustomSessionFactoryInterceptor());

		PersistenceUnitInfoDescriptor puDescriptor = new PersistenceUnitInfoDescriptor(info);
		EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = new EntityManagerFactoryBuilderImpl(puDescriptor, null);

		EntityManagerFactory emf = entityManagerFactoryBuilder.build();
		return emf;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy