Equinox 3.7 seems to be the problem, 3.6 version works perfectly.

Have you got any maven release planned? Load time entity instrumentation and 
OSGI 4.3 for all could be a very good thing.



Best regards, Charlie

From: [email protected]
To: [email protected]
Subject: RE: Aries & Open JPA: Data not persisted
Date: Sun, 25 Mar 2012 20:56:56 +0200







Hi again,


Strange behaviour,


I upgraded my application amount of memory (via JAVA_OPTS=-XX:MaxPerm...) 
(subsidiray question: do you know how to do this with pax-maven-plugin?).
And now, the objects are persisted, but then, my app fall with a permgen space 
and data is not retrieved (my controller that do persist() then getall() 
returns nothing). 
Once the app is restarted, I can retrieve my data.

Do you have any clue?


Best regards, Charlie

From: [email protected]
To: [email protected]
Subject: Aries & Open JPA: Data not persisted
Date: Sun, 25 Mar 2012 12:24:26 +0200







Hi,



My Entities are not persisted when I try to persist.



I have two bundles, a db one with this config (the same as in your tutorial):

[code]

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>
 <bean id="dataSourceDerby" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" />
<property name="url" value="jdbc:derby:/temp/orthankdb;create=true" />
<property name="username" value="" />
<property name="password" value="" />
 </bean>
<service ref="dataSourceDerby" interface="javax.sql.DataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/orthankdb" />
</service-properties>
</service>
</blueprint>

[/code]



And a jpa bundle with a mapped superclass (containing Id & version) and an 
entity that inherit (containing a String).

[code]
@MappedSuperclass
@XmlRootElement
public abstract class BaseEntity implements Serializable {
        private static final long serialVersionUID = 1L;
        
        private Long id;
        
        private Long version;
        @XmlElement
        @Version
        public Long getVersion() {
                return version;
        }
        @XmlElement
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        public Long getId() {
                return id;
        }
}
@Entity
@NamedQueries(
                value={@NamedQuery(name="getAllValuesTest", query="select v 
from ValuesTest v")}
                )
@XmlRootElement(name="valuesTest")
@XmlType(name = "valuesTest", namespace = "http://orthank-model/";)
@Table(name="VALUESTEST")
public class ValuesTest extends BaseEntity  {

private Date dateVal;

private String stringVal;
private static final int STRINGVAL_MIN = 1;
private static final int STRINGVAL_MAX = 20;
@XmlElement
@Temporal(TemporalType.TIMESTAMP)
@Column(name="DATEVAL")
public Date getDateVal() {
return this.dateVal;
}
@NotNull(message = "stringVal must not be null")
@Size(
min = STRINGVAL_MIN,
max = STRINGVAL_MAX,
message = "length of stringVal must be between" + STRINGVAL_MIN + " and " + 
STRINGVAL_MAX
)
@Pattern(
regexp = "[A-Za-z0-9]+",
message = "stringVal must contain characters")
@XmlElement
//End of user code
@Basic(fetch=FetchType.LAZY)
@Column(name="STRINGVAL")
public String getStringVal() {
return this.stringVal;
}
@Transient
public static int getStringvalMin() {
        return STRINGVAL_MIN;
}
@Transient
public static int getStringvalMax() {
        return STRINGVAL_MAX;
}

[/code]


I've openjpa enhancer declared on my pom.xml plus this persistence.xml:

[code]

<persistence xmlns="http://java.sun.com/xml/ns/persistence";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="2.0">
<persistence-unit name="orthank" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl
  </provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/orthankdb)
</jta-data-source>
  <class>net.osgiliath.entities.BaseEntity</class><!--the mapped superclass-->
<class>net.osgiliath.entities.ValuesTest</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
  <properties>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
</properties>
</persistence-unit>
</persistence>

[/code]



Finally, my daos blueprint.xml:

[code]

<service ref="valuesTestDao" interface="net.osgiliath.dao.ValuesTestDao"/>
  <bean id="valuesTestDao" class="net.osgiliath.dao.impl.ValuesTestDaoImpl">
<jpa:context property="entityManager" unitname="orthank" /> 
<tx:transaction method="*" value="Required" />
</bean>

[/code]



I'm using these bundles:



[code]

id State Bundle
0 ACTIVE org.eclipse.osgi_3.7.1.R37x_v20110808-1106
1 ACTIVE org.eclipse.osgi.services_3.3.0.v20110513
2 ACTIVE org.eclipse.osgi.util_3.2.200.v20110110
3 ACTIVE org.eclipse.equinox.common_3.6.0.v20110523
4 ACTIVE osgi.core_4.3.0.201102171602
5 ACTIVE osgi.cmpn_4.2.0.200908310645
9 ACTIVE org.apache.aries.blueprint_0.4.0
10 ACTIVE org.apache.aries.util_0.4.0
11 ACTIVE org.apache.aries.proxy_0.4.0
12 ACTIVE org.apache.servicemix.bundles.cglib_2.2.0.2
13 ACTIVE org.springframework.transaction_3.1.0.RELEASE
16 ACTIVE org.apache.openjpa_2.1.1
17 ACTIVE org.apache.geronimo.specs.geronimo-jpa_2.0_spec_1.1.0
18 ACTIVE org.apache.geronimo.specs.geronimo-jta_1.1_spec_1.1.1
19 ACTIVE javax.persistence_2.0.3.v201010191057
20 ACTIVE org.springframework.orm_3.1.0.RELEASE
21 ACTIVE org.springframework.aop_3.1.0.RELEASE
24 ACTIVE org.springframework.asm_3.1.0.RELEASE
25 ACTIVE org.objectweb.asm.all_3.3.1
26 ACTIVE org.apache.aries.jpa.api_0.3.0
27 ACTIVE org.apache.aries.jpa.container_0.3.0
29 ACTIVE org.apache.aries.jpa.blueprint.aries_0.3.0
30 ACTIVE org.apache.aries.jpa.container.context_0.3.0
31 ACTIVE org.apache.aries.transaction.manager_0.3.0
32 ACTIVE org.apache.aries.transaction.wrappers_0.3.0
33 ACTIVE org.apache.aries.transaction.blueprint_0.3.0
34 ACTIVE org.apache.aries.jndi_0.3.1
35 ACTIVE com.springsource.org.apache.derby_10.5.1000001.764942
36 ACTIVE com.springsource.org.apache.commons.dbcp_1.2.2.osgi
37 ACTIVE org.apache.commons.pool_1.5.6
130 ACTIVE org.hibernate.validation.osgi_0.0.1.SNAPSHOT
131 ACTIVE com.springsource.org.aspectj.runtime_1.6.8.RELEASE
132 ACTIVE com.springsource.org.aspectj.weaver_1.6.8.RELEASE

[/code]

I've valuable nothing in the trace, I know that database and tables are 
created, but when I try to persist my entyties, nothing is registered in the 
database.

Have you got an idea?
Are you interested by the code? It's portable (pax) and interagtes techs like 
cxf, jsf, bval...


Regards, Charlie






                                                                                
                                          

Reply via email to