You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Patrick Linskey (JIRA)" <ji...@apache.org> on 2008/01/15 22:53:33 UTC

[jira] Created: (OPENJPA-486) OpenJPAEntityManager.createInstance(Class cls) fails when T is an abstract class

OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is an abstract class
-----------------------------------------------------------------------------------

                 Key: OPENJPA-486
                 URL: https://issues.apache.org/jira/browse/OPENJPA-486
             Project: OpenJPA
          Issue Type: New Feature
          Components: jpa
            Reporter: Pinaki Poddar
             Fix For: 1.1.0


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-486) OpenJPAEntityManager.createInstance(Class cls) fails when T is an abstract class

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

Patrick Linskey updated OPENJPA-486:
------------------------------------

    Fix Version/s:     (was: 1.1.0)
                   1.2.0

> OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is an abstract class
> -----------------------------------------------------------------------------------
>
>                 Key: OPENJPA-486
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-486
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: jpa
>            Reporter: Pinaki Poddar
>             Fix For: 1.2.0
>
>
> 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 abstract class.

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


[jira] Updated: (OPENJPA-486) OpenJPAEntityManager.createInstance(Class cls) fails when T is an abstract class

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

Patrick Linskey updated OPENJPA-486:
------------------------------------

    Description: 
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 abstract class.

  was:
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. 
 



> OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is an abstract class
> -----------------------------------------------------------------------------------
>
>                 Key: OPENJPA-486
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-486
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: jpa
>            Reporter: Pinaki Poddar
>             Fix For: 1.1.0
>
>
> 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 abstract class.

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


[jira] Commented: (OPENJPA-486) OpenJPAEntityManager.createInstance(Class cls) fails when T is an abstract class

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592689#action_12592689 ] 

Patrick Linskey commented on OPENJPA-486:
-----------------------------------------

I believe that the correct behavior is to generate a concrete impl on the fly.


> OpenJPAEntityManager.createInstance(Class<T> cls) fails when T is an abstract class
> -----------------------------------------------------------------------------------
>
>                 Key: OPENJPA-486
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-486
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: jpa
>            Reporter: Pinaki Poddar
>             Fix For: 1.1.0
>
>
> 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 abstract class.

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