Re: Enhancement skipping field
Just adding the class for reference @Embeddable //public class Phone extends EmbeddedUUID implements WebOptionString, Serializable { public class Phone implements WebOptionString, Serializable { private static final long serialVersionUID = 1L; @Persistent private UUID id; @Persistent @NotEmpty(message = "{phone.number.required}") @NumericString(message = "{phone.number.digitsonly}") private String number; @Persistent private String countryIdd; @Persistent @NotNull(message = "{phone.country.required}") private String iddCountryCode; @Persistent @NotNull(message = "{phone.type.required}") private PhoneType type; public Phone() { id = new UUID(); } public Phone(String number, Country country, PhoneType type) { this(); this.number = number; this.type = type; setIddCountry(country); } public void setNumber(String number) { this.number = number; } public String getNumber() { return number; } public void setType(PhoneType type) { this.type = type; } public PhoneType getType() { return type; } @Override public String getDisplayString() { return number; } public void setIddCountry(Country country) { if (country != null) { this.iddCountryCode = country.getCode(); this.countryIdd = country.getIdd(); } } public Country getIddCountry() { if (iddCountryCode != null) { return CountryFactory.INSTANCE.getByCode(this.iddCountryCode); } return null; } public String getIddCountryCode() { return iddCountryCode; } public String getFullNumber() { return (countryIdd == null ? "" : countryIdd) + (number == null ? "" : number); } public void clone(Phone other) { Assert.notNull(other); setIddCountry(other.getIddCountry()); setNumber(other.getNumber()); setType(other.getType()); } public UUID getId() { return id; } public void setId(UUID id) { Assert.notNull(id); this.id = id; } } On Thu, Jul 7, 2011 at 3:36 PM, Matthew Goodson wrote: > Hi guys. I have a problem with jpa enhancement. > I am using version 2.1.0 and I am trying to get it to enhanced an object > 'Phone' with a field 'id' which is of type com.eaio.UUID. However when I run > the enhancement I get the 2 warnings below. > Any ideas? > > 411 openjpa WARN [main] openjpa.MetaData - Field " > com.spidertracks.aviator.model.user.Phone.id" is not a type that is > persistent by default. If you want this field to be persistent, you have to > explicitly set it to persistent in your metadata. > > 681 openjpa WARN [main] openjpa.Enhance - Type "class > com.spidertracks.aviator.model.user.Phone_" loaded by > java.net.URLClassLoader@69dfe453 has no metadata; enhancing as persistence > aware. If you intended for "class > com.spidertracks.aviator.model.user.Phone_" to be persistence-capable, then > this means that OpenJPA could not find any metadata for "class > com.spidertracks.aviator.model.user.Phone_". This can happen if the > directory containing your metadata is not in your CLASSPATH, or if your > metadata files are not named properly. See the documentation on metadata > placement for more information. >
Enhancement skipping field
Hi guys. I have a problem with jpa enhancement. I am using version 2.1.0 and I am trying to get it to enhanced an object 'Phone' with a field 'id' which is of type com.eaio.UUID. However when I run the enhancement I get the 2 warnings below. Any ideas? 411 openjpa WARN [main] openjpa.MetaData - Field " com.spidertracks.aviator.model.user.Phone.id" is not a type that is persistent by default. If you want this field to be persistent, you have to explicitly set it to persistent in your metadata. 681 openjpa WARN [main] openjpa.Enhance - Type "class com.spidertracks.aviator.model.user.Phone_" loaded by java.net.URLClassLoader@69dfe453 has no metadata; enhancing as persistence aware. If you intended for "class com.spidertracks.aviator.model.user.Phone_" to be persistence-capable, then this means that OpenJPA could not find any metadata for "class com.spidertracks.aviator.model.user.Phone_". This can happen if the directory containing your metadata is not in your CLASSPATH, or if your metadata files are not named properly. See the documentation on metadata placement for more information.
Re: How to store a string array as a string array using jpa?
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_pc_extern On Wed, Jul 6, 2011 at 3:37 AM, Suseendran.P wrote: > Hello.., > I'm also looking for the same thing..i check it out the above link but > it's not still alive..so can any one give the proper link or explanation > again.. > Thanks in Advance.. > > -- *Rick Curtis*
Re: How to store a string array as a string array using jpa?
Hello.., I'm also looking for the same thing..i check it out the above link but it's not still alive..so can any one give the proper link or explanation again.. Thanks in Advance.. -- View this message in context: http://openjpa.208410.n2.nabble.com/How-to-store-a-string-array-as-a-string-array-using-jpa-tp209875p6553605.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: Problems with load time enhancement and Spring's TomcatInstrumentableClassLoader
Yes, I read that more than once and double checked my configuration. I also posted in the Spring forum a while ago, with no replies so far. It would be helpful to have some background on the requirements for load time enhancement from the OpenJPA side. How does it normally work in a Java EE container? Does OpenJPA make any assumptions on which classloader is used for - OpenJPA itself - javax.persistence.* classes Should it be the container classloader or the application classloader? If I knew what OpenJPA expects, it would be easier to find out if and where the Spring/Tomcat environment is different and then address the issue to the resposible party - I spent a whole day on this issue and I'm really stuck at this point... Regards, Harald Original-Nachricht > Datum: Wed, 6 Jul 2011 08:46:22 -0500 > Von: Rick Curtis > An: users@openjpa.apache.org > Betreff: Re: Problems with load time enhancement and Spring\'s > TomcatInstrumentableClassLoader > Harold - > > Please take a read through the spring doc[1] to see if they address your > problem. > > [1] > http://static.springsource.org/spring/docs/2.0.x/reference/orm.html#orm-jpa-setup-lcemfb -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
Re: Problems with load time enhancement and Spring's TomcatInstrumentableClassLoader
Harold - Please take a read through the spring doc[1] to see if they address your problem. [1] http://static.springsource.org/spring/docs/2.0.x/reference/orm.html#orm-jpa-setup-lcemfb On Wed, Jul 6, 2011 at 8:25 AM, Harald Wellmann wrote: > I'm trying to use OpenJPA 2.1.0 with Spring 3.0.5 and Tomcat 6.0.32 and a > JPA 2.0 persistence unit configured by annotations. > > At first, the enhancer did not recognize any of my classes, which looks > like the same problem as described in > https://issues.apache.org/jira/browse/OPENJPA-1891. > > Then I moved the Geronimo JPA JAR from my WAR to Tomcat's lib folder as > described in this issue (but this feels wrong somehow). > > After that, the enhancer starts to do some work but then fails with an > exception which I don't really understand. > > It may be related to an inheritance chain in my entity model > > A -> B -> C > > where A is an Entity and B and C are MappedSuperclasses. > > Some trace output > > 8796 foo TRACE [main] openjpa.Enhance - Enhancing type "class com.A" > loaded by WebappClassLoader > context: /foo-web > delegate: false > repositories: >/WEB-INF/classes/ > --> Parent Classloader: > org.apache.catalina.loader.StandardClassLoader@a210b5b > . > 8808 foo TRACE [main] openjpa.Enhance - Enhancement for "com/A" > completed. Class size: [669/3.516] > 8809 foo TRACE [main] openjpa.Enhance - "com/B" requires runtime > enhancement: true > 209144 foo TRACE [main] openjpa.Enhance - Enhancing type "class com/B" > loaded by WebappClassLoader > context: /foo-web > delegate: false > repositories: >/WEB-INF/classes/ > --> Parent Classloader: > org.apache.catalina.loader.StandardClassLoader@a210b5b > . > 209170 foo TRACE [main] openjpa.Enhance - Enhancement for "com/B" > completed. Class size: [1.204/5.336] > 209008 foo WARN [main] openjpa.MetaData - The class "com.A" listed in > the openjpa.MetaDataFactory configuration property could not be loaded by > org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader > WebappClassLoader > context: /foo-web > delegate: false > repositories: >/WEB-INF/classes/ > --> Parent Classloader: > org.apache.catalina.loader.StandardClassLoader@a210b5b > ; ignoring. > 209008 foo TRACE [main] openjpa.MetaData - java.lang.NoSuchMethodError: > com.C.pcGetManagedFieldCount()I > java.lang.NoSuchMethodError: com.C.pcGetManagedFieldCount()I >at com.B.(B.java) >at java.lang.Class.forName0(Native Method) >at java.lang.Class.forName(Class.java:247) >at > org.apache.openjpa.meta.MetaDataRepository.classForName(MetaDataRepository.java:1552) >at > org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1528) >at > org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1506) >at > org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:283) >at > org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:239) >at > org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213) >at > org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156) >at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227) >at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154) >at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60) >at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >at java.lang.reflect.Method.invoke(Method.java:597) >at > org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:423) >at > org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:485) >at $Proxy12.createEntityManager(Unknown Source) > > The missing method appears to be one added by the enhancer, but com.C has > not been enhanced yet. > > I was able to deploy the same unenhanced persistence unit on Glassfish > without problems, so there must be a problem on the interface between > OpenJPA, Spring and Tomcat. > > Any ideas anyone...? > > Thanks, > Harald > > - *Rick Curtis*
Problems with load time enhancement and Spring's TomcatInstrumentableClassLoader
I'm trying to use OpenJPA 2.1.0 with Spring 3.0.5 and Tomcat 6.0.32 and a JPA 2.0 persistence unit configured by annotations. At first, the enhancer did not recognize any of my classes, which looks like the same problem as described in https://issues.apache.org/jira/browse/OPENJPA-1891. Then I moved the Geronimo JPA JAR from my WAR to Tomcat's lib folder as described in this issue (but this feels wrong somehow). After that, the enhancer starts to do some work but then fails with an exception which I don't really understand. It may be related to an inheritance chain in my entity model A -> B -> C where A is an Entity and B and C are MappedSuperclasses. Some trace output 8796 foo TRACE [main] openjpa.Enhance - Enhancing type "class com.A" loaded by WebappClassLoader context: /foo-web delegate: false repositories: /WEB-INF/classes/ --> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@a210b5b . 8808 foo TRACE [main] openjpa.Enhance - Enhancement for "com/A" completed. Class size: [669/3.516] 8809 foo TRACE [main] openjpa.Enhance - "com/B" requires runtime enhancement: true 209144 foo TRACE [main] openjpa.Enhance - Enhancing type "class com/B" loaded by WebappClassLoader context: /foo-web delegate: false repositories: /WEB-INF/classes/ --> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@a210b5b . 209170 foo TRACE [main] openjpa.Enhance - Enhancement for "com/B" completed. Class size: [1.204/5.336] 209008 foo WARN [main] openjpa.MetaData - The class "com.A" listed in the openjpa.MetaDataFactory configuration property could not be loaded by org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader WebappClassLoader context: /foo-web delegate: false repositories: /WEB-INF/classes/ --> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@a210b5b ; ignoring. 209008 foo TRACE [main] openjpa.MetaData - java.lang.NoSuchMethodError: com.C.pcGetManagedFieldCount()I java.lang.NoSuchMethodError: com.C.pcGetManagedFieldCount()I at com.B.(B.java) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at org.apache.openjpa.meta.MetaDataRepository.classForName(MetaDataRepository.java:1552) at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1528) at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1506) at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:283) at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:239) at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213) at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156) at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227) at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154) at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:423) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:485) at $Proxy12.createEntityManager(Unknown Source) The missing method appears to be one added by the enhancer, but com.C has not been enhanced yet. I was able to deploy the same unenhanced persistence unit on Glassfish without problems, so there must be a problem on the interface between OpenJPA, Spring and Tomcat. Any ideas anyone...? Thanks, Harald -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de