tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Soto <asot...@gmail.com>
Subject Re: OpenJPA and Java 1.8
Date Thu, 04 Sep 2014 12:44:17 GMT
Not working but see how simple is my model

package org.superbiz;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Book {

@Id
@Column
private String isbn;

@Column(nullable = false)
private String title;

public void setIsbn(String isbn) {
this.isbn = isbn;
}

public String getIsbn() {
return isbn;
}

public void setTitle(String title) {
this.title = title;
}

public String getTitle() {
return title;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((isbn == null) ? 0 : isbn.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Book other = (Book) obj;
if (isbn == null) {
if (other.isbn != null)
return false;
} else if (!isbn.equals(other.isbn))
return false;
return true;
}

}



2014-09-04 14:40 GMT+02:00 Alex Soto <asotobu@gmail.com>:

> it should work with arquillian right?
>
> I have just copied this http://tomee.apache.org/javaagent.html  but
> updating to 4.7.0
>
>
> 2014-09-04 14:25 GMT+02:00 Romain Manni-Bucau <rmannibucau@gmail.com>:
>
> there is no way to use JPA without enhancement. Hibernate supports it
>> accepting to not support some JPA features by default. That's not
>> perfect, you shout after it when booting a project but then that's
>> most of the time ok.
>>
>> OpenJPA will surely be reworked in coming years (whole bytecode part)
>> so hopefully it will be better
>>
>>
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>> 2014-09-04 14:20 GMT+02:00 Alex Soto <asotobu@gmail.com>:
>> > Yes of course but I would prefer to run it transparently without doing
>> more
>> > work.
>> >
>> >
>> > 2014-09-04 14:16 GMT+02:00 Romain Manni-Bucau <rmannibucau@gmail.com>:
>> >
>> >> why?
>> >>
>> >> in embedded idea adds it automatically is configured in maven, for
>> >> maven it is a line in surefire and in tomee it is done so normally it
>> >> doesn't hurt that much
>> >>
>> >> if you choose build time enhancement it is just a goal to call before
>> >> running your app
>> >>
>> >> finally if it really bothers you, you can use hibernate and deal with
>> >> other issues ;)
>> >>
>> >>
>> >> Romain Manni-Bucau
>> >> Twitter: @rmannibucau
>> >> Blog: http://rmannibucau.wordpress.com/
>> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> Github: https://github.com/rmannibucau
>> >>
>> >>
>> >> 2014-09-04 14:12 GMT+02:00 Alex Soto <asotobu@gmail.com>:
>> >> > Ok not so happy about this but well this is the life I guess
>> >> >
>> >> >
>> >> > 2014-09-04 14:10 GMT+02:00 Romain Manni-Bucau <rmannibucau@gmail.com
>> >:
>> >> >
>> >> >> some too simple samples works without it and on java 6 and 7 it
was
>> >> >> easier. With java 8 don't think that much and enhance your classes
>> ;)
>> >> >>
>> >> >>
>> >> >> Romain Manni-Bucau
>> >> >> Twitter: @rmannibucau
>> >> >> Blog: http://rmannibucau.wordpress.com/
>> >> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> >> Github: https://github.com/rmannibucau
>> >> >>
>> >> >>
>> >> >> 2014-09-04 14:05 GMT+02:00 Alex Soto <asotobu@gmail.com>:
>> >> >> > Not seen on pom
>> >> >> >
>> >> >> >
>> >> >> > 2014-09-04 14:02 GMT+02:00 Maxim Solodovnik <solomax666@gmail.com
>> >:
>> >> >> >
>> >> >> >> Maybe classes are being enhances in build time? (using
ant or
>> maven)
>> >> >> >>
>> >> >> >>
>> >> >> >> On 4 September 2014 19:01, Alex Soto <asotobu@gmail.com>
wrote:
>> >> >> >>
>> >> >> >> > :( but examples provided in github about EntityManager
does
>> not use
>> >> >> >> > javaagent. This is because java 8?
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > 2014-09-04 13:58 GMT+02:00 Jean-Louis Monteiro <
>> >> >> jlmonteiro@tomitribe.com
>> >> >> >> >:
>> >> >> >> >
>> >> >> >> > > Subclassing works sometimes (deprecated mode),
but it's
>> >> definitely
>> >> >> what
>> >> >> >> > > OpenJPA recommends.
>> >> >> >> > >
>> >> >> >> > >
>> >> >> >> > > --
>> >> >> >> > > Jean-Louis Monteiro
>> >> >> >> > > http://twitter.com/jlouismonteiro
>> >> >> >> > > http://www.tomitribe.com
>> >> >> >> > >
>> >> >> >> > >
>> >> >> >> > > On Thu, Sep 4, 2014 at 1:53 PM, Alex Soto <asotobu@gmail.com
>> >
>> >> >> wrote:
>> >> >> >> > >
>> >> >> >> > > > O thanks but it worked in other examples
where no
>> javaagent was
>> >> >> >> added.
>> >> >> >> > :)
>> >> >> >> > > >
>> >> >> >> > > >
>> >> >> >> > > > 2014-09-04 13:18 GMT+02:00 Romain Manni-Bucau
<
>> >> >> rmannibucau@gmail.com
>> >> >> >> >:
>> >> >> >> > > >
>> >> >> >> > > > > Hi
>> >> >> >> > > > >
>> >> >> >> > > > > you need to enhance your classes at
build time or ensure
>> you
>> >> >> have
>> >> >> >> > > > > openejb-javaagent set on the JVM
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > > Romain Manni-Bucau
>> >> >> >> > > > > Twitter: @rmannibucau
>> >> >> >> > > > > Blog: http://rmannibucau.wordpress.com/
>> >> >> >> > > > > LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> >> >> > > > > Github: https://github.com/rmannibucau
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > > 2014-09-04 13:14 GMT+02:00 Alex Soto
<asotobu@gmail.com
>> >:
>> >> >> >> > > > > > Hi,
>> >> >> >> > > > > >
>> >> >> >> > > > > > I am creating a very simple example
using OpenJPA and
>> TomEE
>> >> >> and I
>> >> >> >> > > > receive
>> >> >> >> > > > > > this exception.
>> >> >> >> > > > > >
>> >> >> >> > > > > > INFO: Creating subclass and redefining
methods for
>> "[class
>> >> >> >> > > > > > org.superbiz.Book]". This means
that your application
>> will
>> >> be
>> >> >> >> less
>> >> >> >> > > > > > efficient than it would if you
ran the OpenJPA
>> enhancer.
>> >> >> >> > > > > > Sep 04, 2014 1:09:31 PM
>> >> >> >> > > > > > org.apache.openejb.core.transaction.EjbTransactionUtil
>> >> >> >> > > > > handleSystemException
>> >> >> >> > > > > > SEVERE: EjbTransactionUtil.handleSystemException:
null
>> >> >> >> > > > > > <openjpa-2.4.0-nonfinal-1598334-r422266:1599166
fatal
>> >> general
>> >> >> >> > error>
>> >> >> >> > > > > > org.apache.openjpa.persistence.PersistenceException:
>> null
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openjpa.enhance.ClassRedefiner.redefineClasses(ClassRedefiner.java:96)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:176)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:311)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:235)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:211)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:160)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:119)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:96)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.persistence.JtaEntityManager.persist(JtaEntityManager.java:144)
>> >> >> >> > > > > > at
>> org.superbiz.BookManager.createBook(BookManager.java:14)
>> >> >> >> > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> >> Method)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> >> >> >> > > > > > at java.lang.reflect.Method.invoke(Method.java:483)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
>> >> >> >> > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> >> Method)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> >> >> >> > > > > > at java.lang.reflect.Method.invoke(Method.java:483)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:227)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:194)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:308)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:303)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:92)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:308)
>> >> >> >> > > > > > at
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.superbiz.BookManager$$LocalBeanProxy.createBook(org/superbiz/BookManager.java)
>> >> >> >> > > > > >
>> >> >> >> > > > > > It is a really simple example
do you think it may be
>> caused
>> >> >> >> because
>> >> >> >> > > of
>> >> >> >> > > > > > using Java 8?
>> >> >> >> > > > > > --
>> >> >> >> > > > > >
>> >> +----------------------------------------------------------+
>> >> >> >> > > > > >   Alex Soto Bueno
>> >> >> >> > > > > >   www.lordofthejars.com
>> >> >> >> > > > > >
>> >> +----------------------------------------------------------+
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > > >
>> >> >> >> > > >
>> >> >> >> > > > --
>> >> >> >> > > >
>> +----------------------------------------------------------+
>> >> >> >> > > >   Alex Soto Bueno - Computer Engineer
>> >> >> >> > > >   www.lordofthejars.com
>> >> >> >> > > >
>> +----------------------------------------------------------+
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > +----------------------------------------------------------+
>> >> >> >> >   Alex Soto Bueno - Computer Engineer
>> >> >> >> >   www.lordofthejars.com
>> >> >> >> > +----------------------------------------------------------+
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> WBR
>> >> >> >> Maxim aka solomax
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > +----------------------------------------------------------+
>> >> >> >   Alex Soto Bueno - Computer Engineer
>> >> >> >   www.lordofthejars.com
>> >> >> > +----------------------------------------------------------+
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > +----------------------------------------------------------+
>> >> >   Alex Soto Bueno - Computer Engineer
>> >> >   www.lordofthejars.com
>> >> > +----------------------------------------------------------+
>> >>
>> >
>> >
>> >
>> > --
>> > +----------------------------------------------------------+
>> >   Alex Soto Bueno - Computer Engineer
>> >   www.lordofthejars.com
>> > +----------------------------------------------------------+
>>
>
>
>
> --
> +----------------------------------------------------------+
>   Alex Soto Bueno - Computer Engineer
>   www.lordofthejars.com
> +----------------------------------------------------------+
>



-- 
+----------------------------------------------------------+
  Alex Soto Bueno - Computer Engineer
  www.lordofthejars.com
+----------------------------------------------------------+

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message