You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "santiago garcía pimentel (Created JIRA)" <ji...@apache.org> on 2012/03/29 22:18:22 UTC
[jira] [Created] (OPENJPA-2166) the column for @id is named id no
matter the field name or @column
the column for @id is named id no matter the field name or @column
------------------------------------------------------------------
Key: OPENJPA-2166
URL: https://issues.apache.org/jira/browse/OPENJPA-2166
Project: OpenJPA
Issue Type: Bug
Components: sql
Affects Versions: 2.2.0
Environment: ubuntu 64bits, java 1.7.0_01
Reporter: santiago garcía pimentel
Priority: Minor
I have an entity with an Id:
@Entity
@Table(name = "Domain")
public class Domain implements java.io.Serializable, Comparable<Domain> {
...
@Id
@Column(name = "name", unique = true, nullable = false)
public final String getName() {
return this.name;
}
...
still openjpa seems to be querying for a column id instead of name
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (OPENJPA-2166) the column for @id is named id no
matter the field name or @column
Posted by "Jody Grassel (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-2166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13242400#comment-13242400 ]
Jody Grassel commented on OPENJPA-2166:
---------------------------------------
That has absolutely nothing to do with anything. Your getName() method has the "final" key word, which is forbidden -- I even cited the relevant section of the spec.
Remove the "final" keyword and you should be fine.
> the column for @id is named id no matter the field name or @column
> ------------------------------------------------------------------
>
> Key: OPENJPA-2166
> URL: https://issues.apache.org/jira/browse/OPENJPA-2166
> Project: OpenJPA
> Issue Type: Bug
> Components: sql
> Affects Versions: 2.2.0
> Environment: ubuntu 64bits, java 1.7.0_01
> Reporter: santiago garcía pimentel
> Priority: Minor
> Labels: mapping
>
> I have an entity with an Id:
> @Entity
> @Table(name = "Domain")
> public class Domain implements java.io.Serializable, Comparable<Domain> {
> ...
> @Id
> @Column(name = "name", unique = true, nullable = false)
> public final String getName() {
> return this.name;
> }
> ...
> still openjpa seems to be querying for a column id instead of name
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (OPENJPA-2166) the column for @id is named id no
matter the field name or @column
Posted by "Jody Grassel (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-2166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13241773#comment-13241773 ]
Jody Grassel commented on OPENJPA-2166:
---------------------------------------
I experimented with the above example, and confirmed that indeed it does use "id" instead of "name":
2548 TestPU TRACE [main] openjpa.jdbc.SQL - <t 2057079871, conn 292826622> executing stmnt 534000652 CREATE TABLE TestEntity (id BIGINT NOT NULL, -- datastore id
intVal INTEGER, PRIMARY KEY (id))
However, the JPA 2 Specification (Section 2.1 "The Entity Class", page 21) states: "The entity class must not be final. No methods or persistent instance variables of the entity class may be final." In your example, you have the final keyword in getName(). Removing it produced the following:
2577 TestPU TRACE [main] openjpa.jdbc.SQL - <t 225005258, conn 2098993638> executing stmnt 1083655680 CREATE TABLE TestEntity (name VARCHAR(255) NOT NULL, intVal INTEGER, PRIMARY KEY (name))
Which is the correct behavior (and my test was then able to persist/fetch the entity). That said, this is still not a proper way for OpenJPA to behave.
> the column for @id is named id no matter the field name or @column
> ------------------------------------------------------------------
>
> Key: OPENJPA-2166
> URL: https://issues.apache.org/jira/browse/OPENJPA-2166
> Project: OpenJPA
> Issue Type: Bug
> Components: sql
> Affects Versions: 2.2.0
> Environment: ubuntu 64bits, java 1.7.0_01
> Reporter: santiago garcía pimentel
> Priority: Minor
> Labels: mapping
>
> I have an entity with an Id:
> @Entity
> @Table(name = "Domain")
> public class Domain implements java.io.Serializable, Comparable<Domain> {
> ...
> @Id
> @Column(name = "name", unique = true, nullable = false)
> public final String getName() {
> return this.name;
> }
> ...
> still openjpa seems to be querying for a column id instead of name
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (OPENJPA-2166) the column for @id is named id no
matter the field name or @column
Posted by "Rick Curtis (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-2166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13241610#comment-13241610 ]
Rick Curtis commented on OPENJPA-2166:
--------------------------------------
How are you enhancing your Entities?
Can you enable SQL=trace and post that data?
Thanks,
Rick
> the column for @id is named id no matter the field name or @column
> ------------------------------------------------------------------
>
> Key: OPENJPA-2166
> URL: https://issues.apache.org/jira/browse/OPENJPA-2166
> Project: OpenJPA
> Issue Type: Bug
> Components: sql
> Affects Versions: 2.2.0
> Environment: ubuntu 64bits, java 1.7.0_01
> Reporter: santiago garcía pimentel
> Priority: Minor
> Labels: mapping
>
> I have an entity with an Id:
> @Entity
> @Table(name = "Domain")
> public class Domain implements java.io.Serializable, Comparable<Domain> {
> ...
> @Id
> @Column(name = "name", unique = true, nullable = false)
> public final String getName() {
> return this.name;
> }
> ...
> still openjpa seems to be querying for a column id instead of name
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (OPENJPA-2166) the column for @id is named id no
matter the field name or @column
Posted by "santiago garcía pimentel (Commented JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-2166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13243090#comment-13243090 ]
santiago garcía pimentel commented on OPENJPA-2166:
---------------------------------------------------
thanks. It is already working. I only was giving extra information since you said that it was not the proper way for openjpa to behave.
> the column for @id is named id no matter the field name or @column
> ------------------------------------------------------------------
>
> Key: OPENJPA-2166
> URL: https://issues.apache.org/jira/browse/OPENJPA-2166
> Project: OpenJPA
> Issue Type: Bug
> Components: sql
> Affects Versions: 2.2.0
> Environment: ubuntu 64bits, java 1.7.0_01
> Reporter: santiago garcía pimentel
> Priority: Minor
> Labels: mapping
>
> I have an entity with an Id:
> @Entity
> @Table(name = "Domain")
> public class Domain implements java.io.Serializable, Comparable<Domain> {
> ...
> @Id
> @Column(name = "name", unique = true, nullable = false)
> public final String getName() {
> return this.name;
> }
> ...
> still openjpa seems to be querying for a column id instead of name
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (OPENJPA-2166) the column for @id is named id no
matter the field name or @column
Posted by "Rick Curtis (Closed) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-2166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rick Curtis closed OPENJPA-2166.
--------------------------------
Resolution: Duplicate
Assignee: Rick Curtis
Closing as this issue is resolved from the users point of view. The outstanding logging issue will be handled in OPENJPA-1977.
> the column for @id is named id no matter the field name or @column
> ------------------------------------------------------------------
>
> Key: OPENJPA-2166
> URL: https://issues.apache.org/jira/browse/OPENJPA-2166
> Project: OpenJPA
> Issue Type: Bug
> Components: sql
> Affects Versions: 2.2.0
> Environment: ubuntu 64bits, java 1.7.0_01
> Reporter: santiago garcía pimentel
> Assignee: Rick Curtis
> Priority: Minor
> Labels: mapping
>
> I have an entity with an Id:
> @Entity
> @Table(name = "Domain")
> public class Domain implements java.io.Serializable, Comparable<Domain> {
> ...
> @Id
> @Column(name = "name", unique = true, nullable = false)
> public final String getName() {
> return this.name;
> }
> ...
> still openjpa seems to be querying for a column id instead of name
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (OPENJPA-2166) the column for @id is named id no
matter the field name or @column
Posted by "santiago garcía pimentel (Commented JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-2166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13243089#comment-13243089 ]
santiago garcía pimentel commented on OPENJPA-2166:
---------------------------------------------------
thanks. It is already working. I only was giving extra information since you said that it was not the proper way for openjpa to behave.
> the column for @id is named id no matter the field name or @column
> ------------------------------------------------------------------
>
> Key: OPENJPA-2166
> URL: https://issues.apache.org/jira/browse/OPENJPA-2166
> Project: OpenJPA
> Issue Type: Bug
> Components: sql
> Affects Versions: 2.2.0
> Environment: ubuntu 64bits, java 1.7.0_01
> Reporter: santiago garcía pimentel
> Priority: Minor
> Labels: mapping
>
> I have an entity with an Id:
> @Entity
> @Table(name = "Domain")
> public class Domain implements java.io.Serializable, Comparable<Domain> {
> ...
> @Id
> @Column(name = "name", unique = true, nullable = false)
> public final String getName() {
> return this.name;
> }
> ...
> still openjpa seems to be querying for a column id instead of name
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (OPENJPA-2166) the column for @id is named id no
matter the field name or @column
Posted by "Rick Curtis (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-2166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13241847#comment-13241847 ]
Rick Curtis commented on OPENJPA-2166:
--------------------------------------
Nice catch Joe. I think OpenJPA should be logging a message (WARN) that we encountered a final field and we're ignoring it. This is the second time that this same-ish issue[1] has been opened.
[1] https://issues.apache.org/jira/browse/OPENJPA-1977
Thanks,
Rick
> the column for @id is named id no matter the field name or @column
> ------------------------------------------------------------------
>
> Key: OPENJPA-2166
> URL: https://issues.apache.org/jira/browse/OPENJPA-2166
> Project: OpenJPA
> Issue Type: Bug
> Components: sql
> Affects Versions: 2.2.0
> Environment: ubuntu 64bits, java 1.7.0_01
> Reporter: santiago garcía pimentel
> Priority: Minor
> Labels: mapping
>
> I have an entity with an Id:
> @Entity
> @Table(name = "Domain")
> public class Domain implements java.io.Serializable, Comparable<Domain> {
> ...
> @Id
> @Column(name = "name", unique = true, nullable = false)
> public final String getName() {
> return this.name;
> }
> ...
> still openjpa seems to be querying for a column id instead of name
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (OPENJPA-2166) the column for @id is named id no
matter the field name or @column
Posted by "santiago garcía pimentel (Commented JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-2166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13242253#comment-13242253 ]
santiago garcía pimentel commented on OPENJPA-2166:
---------------------------------------------------
hi. I am enhacing them using the maven plugin as the site suggests. I am using openjpa version 2.2.0
> the column for @id is named id no matter the field name or @column
> ------------------------------------------------------------------
>
> Key: OPENJPA-2166
> URL: https://issues.apache.org/jira/browse/OPENJPA-2166
> Project: OpenJPA
> Issue Type: Bug
> Components: sql
> Affects Versions: 2.2.0
> Environment: ubuntu 64bits, java 1.7.0_01
> Reporter: santiago garcía pimentel
> Priority: Minor
> Labels: mapping
>
> I have an entity with an Id:
> @Entity
> @Table(name = "Domain")
> public class Domain implements java.io.Serializable, Comparable<Domain> {
> ...
> @Id
> @Column(name = "name", unique = true, nullable = false)
> public final String getName() {
> return this.name;
> }
> ...
> still openjpa seems to be querying for a column id instead of name
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira