mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-02 19:27:57 +08:00
- Temporarily remove dependency on Chile
- Simple persistence interface
This commit is contained in:
parent
514929c71b
commit
a1f488653c
8
cuba.ipr
8
cuba.ipr
@ -277,13 +277,9 @@
|
||||
<component name="WebServicesPlugin" addRequiredLibraries="true" />
|
||||
<component name="libraryTable">
|
||||
<library name="chile">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../chile/build/chile-core.jar!/" />
|
||||
</CLASSES>
|
||||
<CLASSES />
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="file://$PROJECT_DIR$/../chile/modules/core/src" />
|
||||
</SOURCES>
|
||||
<SOURCES />
|
||||
</library>
|
||||
<library name="server">
|
||||
<CLASSES>
|
||||
|
@ -6,25 +6,25 @@
|
||||
<property name="root.dir" location="${project.dir}/.."/>
|
||||
|
||||
<property name="module.name" value="core"/>
|
||||
<property name="module.jar" value="cuba-core.jar"/>
|
||||
<property name="module.jar" value="20-cuba-core.jar"/>
|
||||
|
||||
<import file="${root.dir}/build-inc.xml"/>
|
||||
<property file="${root.dir}/build.properties"/>
|
||||
|
||||
<fileset id="chile-jars" dir="${root.dir}/chile/build">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
|
||||
<path id="compile-cp">
|
||||
<fileset refid="common-lib-fs"/>
|
||||
<fileset refid="server-lib-fs"/>
|
||||
<fileset dir="${root.dir}/chile/build">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<!--<fileset refid="chile-jars"/>-->
|
||||
</path>
|
||||
|
||||
<path id="test-compile-cp">
|
||||
<fileset refid="common-lib-fs"/>
|
||||
<fileset refid="server-lib-fs"/>
|
||||
<fileset dir="${root.dir}/chile/build">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<!--<fileset refid="chile-jars"/>-->
|
||||
</path>
|
||||
|
||||
</project>
|
14
modules/core/src/com/haulmont/cuba/core/BaseEntity.java
Normal file
14
modules/core/src/com/haulmont/cuba/core/BaseEntity.java
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
|
||||
* Author: Konstantin Krivopustov
|
||||
* Created: 31.10.2008 16:51:51
|
||||
* $Id$
|
||||
*/
|
||||
package com.haulmont.cuba.core;
|
||||
|
||||
public interface BaseEntity
|
||||
{
|
||||
}
|
@ -4,13 +4,13 @@
|
||||
*/
|
||||
package com.haulmont.cuba.core;
|
||||
|
||||
import com.haulmont.chile.core.ChileCore;
|
||||
//import com.haulmont.chile.core.ChileCore;
|
||||
|
||||
public class CubaCore {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello from CubaCore");
|
||||
new ChileCore();
|
||||
// new ChileCore();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
|
||||
* Author: Konstantin Krivopustov
|
||||
* Created: 31.10.2008 16:56:32
|
||||
* $Id$
|
||||
*/
|
||||
package com.haulmont.cuba.core;
|
||||
|
||||
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
||||
|
||||
public class CubaEntityManager
|
||||
{
|
||||
private OpenJPAEntityManager jpaEm;
|
||||
|
||||
CubaEntityManager(OpenJPAEntityManager jpaEntityManager) {
|
||||
this.jpaEm = jpaEntityManager;
|
||||
}
|
||||
|
||||
public void insert(BaseEntity entity) {
|
||||
jpaEm.persist(entity);
|
||||
}
|
||||
|
||||
public <T> T merge(BaseEntity entity) {
|
||||
return (T) jpaEm.merge(entity);
|
||||
}
|
||||
|
||||
public void delete(BaseEntity entity) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
|
||||
* Author: Konstantin Krivopustov
|
||||
* Created: 31.10.2008 16:55:55
|
||||
* $Id$
|
||||
*/
|
||||
package com.haulmont.cuba.core;
|
||||
|
||||
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
|
||||
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
||||
|
||||
public class CubaEntityManagerFactory
|
||||
{
|
||||
private OpenJPAEntityManagerFactory jpaFactory;
|
||||
|
||||
public CubaEntityManagerFactory(OpenJPAEntityManagerFactory jpaFactory) {
|
||||
this.jpaFactory = jpaFactory;
|
||||
}
|
||||
|
||||
public CubaEntityManager getEntityManager() {
|
||||
OpenJPAEntityManager em = jpaFactory.createEntityManager();
|
||||
return new CubaEntityManager(em);
|
||||
}
|
||||
}
|
23
modules/core/src/com/haulmont/cuba/core/ServiceLocator.java
Normal file
23
modules/core/src/com/haulmont/cuba/core/ServiceLocator.java
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
|
||||
* Author: Konstantin Krivopustov
|
||||
* Created: 31.10.2008 17:58:40
|
||||
* $Id$
|
||||
*/
|
||||
package com.haulmont.cuba.core;
|
||||
|
||||
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
|
||||
import org.apache.openjpa.persistence.OpenJPAPersistence;
|
||||
|
||||
public class ServiceLocator
|
||||
{
|
||||
public static CubaEntityManagerFactory getEntityManagerFactory() {
|
||||
OpenJPAEntityManagerFactory jpaFactory =
|
||||
OpenJPAPersistence.createEntityManagerFactory("cuba", "META-INF/cuba-persistence.xml");
|
||||
|
||||
return new CubaEntityManagerFactory(jpaFactory);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user