small correction :

public class SomeDao {
   @SuppressWarnings("unchecked")
   public Object getMetaData(Class clazz, long oid) {
       Object o = em.find(clazz, oid);
       return o;
   }
..
}


CALLER: 

Object o = someDao.getMetaData(Foo.class, 1);

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 03.12.2009 um 13:06 schrieb Marc Logemann:

> Hi,
> 
> i am facing some weird performance issues. Given this  JPA Query:
> 
> public class SomeDao {
>    @SuppressWarnings("unchecked")
>    public Object getMetaData(Foo.class, long oid) {
>        Object o = em.find(clazz, client);
>        return o;
>    }
> ..
> }
> 
> 
> @Entity
> @VersionColumn(name = "jpaversion")
> @Table(name = "foo")
> public class Foo extends BasicClientMetaData {
> 
>    @Id
>    @Column(name = "client_oid")
>    private long client;
> ...
> }
> 
> @MappedSuperclass
> public class BasicClientMetaData implements MinMaxWeightAware {
> 
> 
>    @Column(name = "custnr")
>    private String customerNumber;
> 
>    @Column(name = "maxweight")
>    private float maxWeightStandard;
> ..
> }
> 
> When i call the getMetaData() of SomeDao.class (which is transactional and 
> gets detached when its returned to the caller), i measured 500ms for this 
> operation. The underlying SQL only consumes 20ms which i checked by setting 
> the SQL log level to TRACE.
> 
> Why is there such a difference? I mean, detaching cant be such an issue from 
> performance perspective. I only have this issue with exactly these kind of 
> classes (children of BasicClientMetaData).
> 
> But i also have other classes which have the @MappedSuperclass which work 
> without performance problems. Does anyone have a hint where i can look out 
> for?
> 
> 
> thanks.
> 
> ---
> regards
> Marc Logemann
> http://www.logemann.org
> http://www.logentis.de
> 
> 
> 
> 

Reply via email to