You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Pinaki Poddar (JIRA)" <ji...@apache.org> on 2007/02/14 19:19:05 UTC

[jira] Created: (OPENJPA-147) T OpenJPAEntityManager.createInstance(Class cls) fails when T is interface

<T> T OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is interface
---------------------------------------------------------------------------------

                 Key: OPENJPA-147
                 URL: https://issues.apache.org/jira/browse/OPENJPA-147
             Project: OpenJPA
          Issue Type: Bug
          Components: jpa
            Reporter: Pinaki Poddar


According to JavaDoc, OpenJPAEntityManager.createInstance() method 
       public <T> T createInstance(Class<T> cls);
     behaves as follows:

"Create a new instance of type <code>cls</code>. If <code>cls</code> is
  an interface or an abstract class whose abstract methods follow the
  JavaBeans convention, this method will create a concrete implementation
  according to the metadata that defines the class"

The method fails when T is an interface. The failure may be due to incorrect user configuration, however, further
information on this extension method is not available in OpenJPA documentation.

Firstly, how to specify metadata for a interface that has bean-style methods? 
Possibilities are:
a) Annotating the Java interface definition with @Entity 
b) Specifying in <class>org.acme.IPerson</class> in persistence.xml

Either of the above fails. a) fails at parsing b) fails with "no metadata" 

There may be a correct but undocumented way of specifying a managed interface. If that is the case, then this JIRA report should be treated as a documentation bug. 
 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-147) T OpenJPAEntityManager.createInstance(Class cls) fails when T is interface

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473293 ] 

Pinaki Poddar commented on OPENJPA-147:
---------------------------------------

I have attached four trial-and-error scenarios 

Condition (a) is Java interface is annotated with @Entity and condition (b) is <class>IPerson</class> specified in persistence.xml.

Case 1 (iface.trace.1.txt) both (a) and (b) are true : NPE in AnnotationPersistenceMetaDataParser.parseCallbackMethods() 
Case 2: (iface.trace.2.txt) not (a) but (b) : Metadata not found
Case 3:(iface.trace.3.txt)  (a) but not (b) : NPE in AnnotationPersistenceMetaDataParser.parseCallbackMethods() 

Case 4: As I plug the NPE during parsing, and keep both (a) and (b) then the code proceeds further to fail within Enhancer. 

> <T> T OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is interface
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-147
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-147
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Pinaki Poddar
>         Attachments: iface.trace.1.txt, iface.trace.2.txt, iface.trace.3.txt, iface.trace.4.txt, TestInterface.java
>
>
> According to JavaDoc, OpenJPAEntityManager.createInstance() method 
>        public <T> T createInstance(Class<T> cls);
>      behaves as follows:
> "Create a new instance of type <code>cls</code>. If <code>cls</code> is
>   an interface or an abstract class whose abstract methods follow the
>   JavaBeans convention, this method will create a concrete implementation
>   according to the metadata that defines the class"
> The method fails when T is an interface. The failure may be due to incorrect user configuration, however, further
> information on this extension method is not available in OpenJPA documentation.
> Firstly, how to specify metadata for a interface that has bean-style methods? 
> Possibilities are:
> a) Annotating the Java interface definition with @Entity 
> b) Specifying in <class>org.acme.IPerson</class> in persistence.xml
> Either of the above fails. a) fails at parsing b) fails with "no metadata" 
> There may be a correct but undocumented way of specifying a managed interface. If that is the case, then this JIRA report should be treated as a documentation bug. 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-147) T OpenJPAEntityManager.createInstance(Class cls) fails when T is interface

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar updated OPENJPA-147:
----------------------------------

    Attachment: iface.trace.3.txt

> <T> T OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is interface
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-147
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-147
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Pinaki Poddar
>         Attachments: iface.trace.1.txt, iface.trace.2.txt, iface.trace.3.txt, iface.trace.4.txt
>
>
> According to JavaDoc, OpenJPAEntityManager.createInstance() method 
>        public <T> T createInstance(Class<T> cls);
>      behaves as follows:
> "Create a new instance of type <code>cls</code>. If <code>cls</code> is
>   an interface or an abstract class whose abstract methods follow the
>   JavaBeans convention, this method will create a concrete implementation
>   according to the metadata that defines the class"
> The method fails when T is an interface. The failure may be due to incorrect user configuration, however, further
> information on this extension method is not available in OpenJPA documentation.
> Firstly, how to specify metadata for a interface that has bean-style methods? 
> Possibilities are:
> a) Annotating the Java interface definition with @Entity 
> b) Specifying in <class>org.acme.IPerson</class> in persistence.xml
> Either of the above fails. a) fails at parsing b) fails with "no metadata" 
> There may be a correct but undocumented way of specifying a managed interface. If that is the case, then this JIRA report should be treated as a documentation bug. 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-147) T OpenJPAEntityManager.createInstance(Class cls) fails when T is interface

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar updated OPENJPA-147:
----------------------------------

    Attachment: iface.trace.2.txt

> <T> T OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is interface
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-147
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-147
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Pinaki Poddar
>         Attachments: iface.trace.1.txt, iface.trace.2.txt, iface.trace.3.txt, iface.trace.4.txt
>
>
> According to JavaDoc, OpenJPAEntityManager.createInstance() method 
>        public <T> T createInstance(Class<T> cls);
>      behaves as follows:
> "Create a new instance of type <code>cls</code>. If <code>cls</code> is
>   an interface or an abstract class whose abstract methods follow the
>   JavaBeans convention, this method will create a concrete implementation
>   according to the metadata that defines the class"
> The method fails when T is an interface. The failure may be due to incorrect user configuration, however, further
> information on this extension method is not available in OpenJPA documentation.
> Firstly, how to specify metadata for a interface that has bean-style methods? 
> Possibilities are:
> a) Annotating the Java interface definition with @Entity 
> b) Specifying in <class>org.acme.IPerson</class> in persistence.xml
> Either of the above fails. a) fails at parsing b) fails with "no metadata" 
> There may be a correct but undocumented way of specifying a managed interface. If that is the case, then this JIRA report should be treated as a documentation bug. 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-147) T OpenJPAEntityManager.createInstance(Class cls) fails when T is interface

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar updated OPENJPA-147:
----------------------------------

    Attachment: IPerson.java

The Java interface definition is attached. I did not use an orm.xml.

> <T> T OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is interface
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-147
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-147
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Pinaki Poddar
>         Attachments: iface.trace.1.txt, iface.trace.2.txt, iface.trace.3.txt, iface.trace.4.txt, IPerson.java, TestInterface.java
>
>
> According to JavaDoc, OpenJPAEntityManager.createInstance() method 
>        public <T> T createInstance(Class<T> cls);
>      behaves as follows:
> "Create a new instance of type <code>cls</code>. If <code>cls</code> is
>   an interface or an abstract class whose abstract methods follow the
>   JavaBeans convention, this method will create a concrete implementation
>   according to the metadata that defines the class"
> The method fails when T is an interface. The failure may be due to incorrect user configuration, however, further
> information on this extension method is not available in OpenJPA documentation.
> Firstly, how to specify metadata for a interface that has bean-style methods? 
> Possibilities are:
> a) Annotating the Java interface definition with @Entity 
> b) Specifying in <class>org.acme.IPerson</class> in persistence.xml
> Either of the above fails. a) fails at parsing b) fails with "no metadata" 
> There may be a correct but undocumented way of specifying a managed interface. If that is the case, then this JIRA report should be treated as a documentation bug. 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-147) T OpenJPAEntityManager.createInstance(Class cls) fails when T is interface

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar updated OPENJPA-147:
----------------------------------

    Attachment: iface.trace.4.txt

> <T> T OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is interface
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-147
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-147
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Pinaki Poddar
>         Attachments: iface.trace.1.txt, iface.trace.2.txt, iface.trace.3.txt, iface.trace.4.txt
>
>
> According to JavaDoc, OpenJPAEntityManager.createInstance() method 
>        public <T> T createInstance(Class<T> cls);
>      behaves as follows:
> "Create a new instance of type <code>cls</code>. If <code>cls</code> is
>   an interface or an abstract class whose abstract methods follow the
>   JavaBeans convention, this method will create a concrete implementation
>   according to the metadata that defines the class"
> The method fails when T is an interface. The failure may be due to incorrect user configuration, however, further
> information on this extension method is not available in OpenJPA documentation.
> Firstly, how to specify metadata for a interface that has bean-style methods? 
> Possibilities are:
> a) Annotating the Java interface definition with @Entity 
> b) Specifying in <class>org.acme.IPerson</class> in persistence.xml
> Either of the above fails. a) fails at parsing b) fails with "no metadata" 
> There may be a correct but undocumented way of specifying a managed interface. If that is the case, then this JIRA report should be treated as a documentation bug. 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-147) T OpenJPAEntityManager.createInstance(Class cls) fails when T is interface

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar updated OPENJPA-147:
----------------------------------

    Attachment: iface.trace.1.txt

> <T> T OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is interface
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-147
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-147
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Pinaki Poddar
>         Attachments: iface.trace.1.txt, iface.trace.2.txt, iface.trace.3.txt, iface.trace.4.txt
>
>
> According to JavaDoc, OpenJPAEntityManager.createInstance() method 
>        public <T> T createInstance(Class<T> cls);
>      behaves as follows:
> "Create a new instance of type <code>cls</code>. If <code>cls</code> is
>   an interface or an abstract class whose abstract methods follow the
>   JavaBeans convention, this method will create a concrete implementation
>   according to the metadata that defines the class"
> The method fails when T is an interface. The failure may be due to incorrect user configuration, however, further
> information on this extension method is not available in OpenJPA documentation.
> Firstly, how to specify metadata for a interface that has bean-style methods? 
> Possibilities are:
> a) Annotating the Java interface definition with @Entity 
> b) Specifying in <class>org.acme.IPerson</class> in persistence.xml
> Either of the above fails. a) fails at parsing b) fails with "no metadata" 
> There may be a correct but undocumented way of specifying a managed interface. If that is the case, then this JIRA report should be treated as a documentation bug. 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-147) T OpenJPAEntityManager.createInstance(Class cls) fails when T is interface

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473536 ] 

Craig Russell commented on OPENJPA-147:
---------------------------------------

Could you please attach the java definition of test.IPerson and the contents of META-INF/orm.xml to this issue?


> <T> T OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is interface
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-147
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-147
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Pinaki Poddar
>         Attachments: iface.trace.1.txt, iface.trace.2.txt, iface.trace.3.txt, iface.trace.4.txt, TestInterface.java
>
>
> According to JavaDoc, OpenJPAEntityManager.createInstance() method 
>        public <T> T createInstance(Class<T> cls);
>      behaves as follows:
> "Create a new instance of type <code>cls</code>. If <code>cls</code> is
>   an interface or an abstract class whose abstract methods follow the
>   JavaBeans convention, this method will create a concrete implementation
>   according to the metadata that defines the class"
> The method fails when T is an interface. The failure may be due to incorrect user configuration, however, further
> information on this extension method is not available in OpenJPA documentation.
> Firstly, how to specify metadata for a interface that has bean-style methods? 
> Possibilities are:
> a) Annotating the Java interface definition with @Entity 
> b) Specifying in <class>org.acme.IPerson</class> in persistence.xml
> Either of the above fails. a) fails at parsing b) fails with "no metadata" 
> There may be a correct but undocumented way of specifying a managed interface. If that is the case, then this JIRA report should be treated as a documentation bug. 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-147) T OpenJPAEntityManager.createInstance(Class cls) fails when T is interface

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Linskey updated OPENJPA-147:
------------------------------------

    Fix Version/s: 1.0.0

> <T> T OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is interface
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-147
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-147
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Pinaki Poddar
>             Fix For: 1.0.0
>
>         Attachments: iface.trace.1.txt, iface.trace.2.txt, iface.trace.3.txt, iface.trace.4.txt, IPerson.java, TestInterface.java
>
>
> According to JavaDoc, OpenJPAEntityManager.createInstance() method 
>        public <T> T createInstance(Class<T> cls);
>      behaves as follows:
> "Create a new instance of type <code>cls</code>. If <code>cls</code> is
>   an interface or an abstract class whose abstract methods follow the
>   JavaBeans convention, this method will create a concrete implementation
>   according to the metadata that defines the class"
> The method fails when T is an interface. The failure may be due to incorrect user configuration, however, further
> information on this extension method is not available in OpenJPA documentation.
> Firstly, how to specify metadata for a interface that has bean-style methods? 
> Possibilities are:
> a) Annotating the Java interface definition with @Entity 
> b) Specifying in <class>org.acme.IPerson</class> in persistence.xml
> Either of the above fails. a) fails at parsing b) fails with "no metadata" 
> There may be a correct but undocumented way of specifying a managed interface. If that is the case, then this JIRA report should be treated as a documentation bug. 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-147) T OpenJPAEntityManager.createInstance(Class cls) fails when T is interface

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar updated OPENJPA-147:
----------------------------------

    Attachment: TestInterface.java

> <T> T OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is interface
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-147
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-147
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Pinaki Poddar
>         Attachments: iface.trace.1.txt, iface.trace.2.txt, iface.trace.3.txt, iface.trace.4.txt, TestInterface.java
>
>
> According to JavaDoc, OpenJPAEntityManager.createInstance() method 
>        public <T> T createInstance(Class<T> cls);
>      behaves as follows:
> "Create a new instance of type <code>cls</code>. If <code>cls</code> is
>   an interface or an abstract class whose abstract methods follow the
>   JavaBeans convention, this method will create a concrete implementation
>   according to the metadata that defines the class"
> The method fails when T is an interface. The failure may be due to incorrect user configuration, however, further
> information on this extension method is not available in OpenJPA documentation.
> Firstly, how to specify metadata for a interface that has bean-style methods? 
> Possibilities are:
> a) Annotating the Java interface definition with @Entity 
> b) Specifying in <class>org.acme.IPerson</class> in persistence.xml
> Either of the above fails. a) fails at parsing b) fails with "no metadata" 
> There may be a correct but undocumented way of specifying a managed interface. If that is the case, then this JIRA report should be treated as a documentation bug. 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-147) T OpenJPAEntityManager.createInstance(Class cls) fails when T is interface

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473224 ] 

Craig Russell commented on OPENJPA-147:
---------------------------------------

>Firstly, how to specify metadata for a interface that has bean-style methods? 
>Possibilities are: 
>a) Annotating the Java interface definition with @Entity 
>b) Specifying in <class>org.acme.IPerson</class> in persistence.xml 

>Either of the above fails. a) fails at parsing b) fails with "no metadata" 

With a), does the failure occur in OpenJPA code, or does the compiler complain? What is the stack trace?

With b), did you provide metadata as a file, in addition to referring to the interface in persistence.xml?


> <T> T OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is interface
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-147
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-147
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Pinaki Poddar
>
> According to JavaDoc, OpenJPAEntityManager.createInstance() method 
>        public <T> T createInstance(Class<T> cls);
>      behaves as follows:
> "Create a new instance of type <code>cls</code>. If <code>cls</code> is
>   an interface or an abstract class whose abstract methods follow the
>   JavaBeans convention, this method will create a concrete implementation
>   according to the metadata that defines the class"
> The method fails when T is an interface. The failure may be due to incorrect user configuration, however, further
> information on this extension method is not available in OpenJPA documentation.
> Firstly, how to specify metadata for a interface that has bean-style methods? 
> Possibilities are:
> a) Annotating the Java interface definition with @Entity 
> b) Specifying in <class>org.acme.IPerson</class> in persistence.xml
> Either of the above fails. a) fails at parsing b) fails with "no metadata" 
> There may be a correct but undocumented way of specifying a managed interface. If that is the case, then this JIRA report should be treated as a documentation bug. 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.