You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Teresa Kan (JIRA)" <ji...@apache.org> on 2007/07/16 16:11:04 UTC
[jira] Created: (OPENJPA-284) TableJDBCSeq for GeneratedValue.TABLE
did not handle initialValue correctly
TableJDBCSeq for GeneratedValue.TABLE did not handle initialValue correctly
---------------------------------------------------------------------------
Key: OPENJPA-284
URL: https://issues.apache.org/jira/browse/OPENJPA-284
Project: OpenJPA
Issue Type: Bug
Components: jdbc
Affects Versions: 1.0.0
Environment: Window XP, JDK 1.5
Reporter: Teresa Kan
When I tested the GeneratedValue strategy on TABLE, and I found a bug in the TableJDBCSeq that did not set the InitalValue. Therefore, the sequence always start from 1.
Here are the bugs in the TableJDBCSeq:
1) InsertSequence method:
SQLBuffer insert = new SQLBuffer(dict).append("INSERT INTO ").
append(_pkColumn.getTable()).append(" (").
append(_pkColumn).append(", ").append(_seqColumn).
append(") VALUES (").
appendValue(pk, _pkColumn).append(", ").
appendValue(Numbers.valueOf(1), _seqColumn).append(")"); --> Always set the initial value to 1.
2) no getter and setter on the InitialValue.
Here is the annotation:
@TableGenerator(name="Dog_Gen", table ="ID_Gen", pkColumnName="GEN_NAME", valueColumnName="GEN_VAL",pkColumnValue="ID2",initialValue=20,allocationSize=10)
@GeneratedValue(strategy=GenerationType.TABLE, generator="Dog_Gen")
private int id2;
The initial value always started from 1 with the current openjpa implementation.
The fix will be like this:
1) add getter and setter of InitialValue in TableJDBCSeq .
2) add int _initValue variable.
3) Change the InsertSequence method:
SQLBuffer insert = new SQLBuffer(dict).append("INSERT INTO ").
append(_pkColumn.getTable()).append(" (").
append(_pkColumn).append(", ").append(_seqColumn).
append(") VALUES (").
appendValue(pk, _pkColumn).append(", ").
appendValue(_intValue, _seqColumn).append(")"); ---> change to use the initValue instead of 1.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OPENJPA-284) TableJDBCSeq for GeneratedValue.TABLE
did not handle initialValue correctly
Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Craig Russell updated OPENJPA-284:
----------------------------------
Fix Version/s: 1.0.0
> TableJDBCSeq for GeneratedValue.TABLE did not handle initialValue correctly
> ---------------------------------------------------------------------------
>
> Key: OPENJPA-284
> URL: https://issues.apache.org/jira/browse/OPENJPA-284
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc
> Affects Versions: 1.0.0
> Environment: Window XP, JDK 1.5
> Reporter: Teresa Kan
> Fix For: 1.0.0
>
> Attachments: OPENJPA-284.patch
>
>
> When I tested the GeneratedValue strategy on TABLE, and I found a bug in the TableJDBCSeq that did not set the InitalValue. Therefore, the sequence always start from 1.
> Here are the bugs in the TableJDBCSeq:
> 1) InsertSequence method:
> SQLBuffer insert = new SQLBuffer(dict).append("INSERT INTO ").
> append(_pkColumn.getTable()).append(" (").
> append(_pkColumn).append(", ").append(_seqColumn).
> append(") VALUES (").
> appendValue(pk, _pkColumn).append(", ").
> appendValue(Numbers.valueOf(1), _seqColumn).append(")"); --> Always set the initial value to 1.
> 2) no getter and setter on the InitialValue.
> Here is the annotation:
> @TableGenerator(name="Dog_Gen", table ="ID_Gen", pkColumnName="GEN_NAME", valueColumnName="GEN_VAL",pkColumnValue="ID2",initialValue=20,allocationSize=10)
> @GeneratedValue(strategy=GenerationType.TABLE, generator="Dog_Gen")
> private int id2;
> The initial value always started from 1 with the current openjpa implementation.
> The fix will be like this:
> 1) add getter and setter of InitialValue in TableJDBCSeq .
> 2) add int _initValue variable.
> 3) Change the InsertSequence method:
> SQLBuffer insert = new SQLBuffer(dict).append("INSERT INTO ").
> append(_pkColumn.getTable()).append(" (").
> append(_pkColumn).append(", ").append(_seqColumn).
> append(") VALUES (").
> appendValue(pk, _pkColumn).append(", ").
> appendValue(_intValue, _seqColumn).append(")"); ---> change to use the initValue instead of 1.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (OPENJPA-284) TableJDBCSeq for
GeneratedValue.TABLE did not handle initialValue correctly
Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Patrick Linskey resolved OPENJPA-284.
-------------------------------------
Resolution: Fixed
> TableJDBCSeq for GeneratedValue.TABLE did not handle initialValue correctly
> ---------------------------------------------------------------------------
>
> Key: OPENJPA-284
> URL: https://issues.apache.org/jira/browse/OPENJPA-284
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc
> Affects Versions: 1.0.0
> Environment: Window XP, JDK 1.5
> Reporter: Teresa Kan
> Attachments: OPENJPA-284.patch
>
>
> When I tested the GeneratedValue strategy on TABLE, and I found a bug in the TableJDBCSeq that did not set the InitalValue. Therefore, the sequence always start from 1.
> Here are the bugs in the TableJDBCSeq:
> 1) InsertSequence method:
> SQLBuffer insert = new SQLBuffer(dict).append("INSERT INTO ").
> append(_pkColumn.getTable()).append(" (").
> append(_pkColumn).append(", ").append(_seqColumn).
> append(") VALUES (").
> appendValue(pk, _pkColumn).append(", ").
> appendValue(Numbers.valueOf(1), _seqColumn).append(")"); --> Always set the initial value to 1.
> 2) no getter and setter on the InitialValue.
> Here is the annotation:
> @TableGenerator(name="Dog_Gen", table ="ID_Gen", pkColumnName="GEN_NAME", valueColumnName="GEN_VAL",pkColumnValue="ID2",initialValue=20,allocationSize=10)
> @GeneratedValue(strategy=GenerationType.TABLE, generator="Dog_Gen")
> private int id2;
> The initial value always started from 1 with the current openjpa implementation.
> The fix will be like this:
> 1) add getter and setter of InitialValue in TableJDBCSeq .
> 2) add int _initValue variable.
> 3) Change the InsertSequence method:
> SQLBuffer insert = new SQLBuffer(dict).append("INSERT INTO ").
> append(_pkColumn.getTable()).append(" (").
> append(_pkColumn).append(", ").append(_seqColumn).
> append(") VALUES (").
> appendValue(pk, _pkColumn).append(", ").
> appendValue(_intValue, _seqColumn).append(")"); ---> change to use the initValue instead of 1.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OPENJPA-284) TableJDBCSeq for GeneratedValue.TABLE
did not handle initialValue correctly
Posted by "Teresa Kan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Teresa Kan updated OPENJPA-284:
-------------------------------
Attachment: OPENJPA-284.patch
The patch is provided for this jiar report
> TableJDBCSeq for GeneratedValue.TABLE did not handle initialValue correctly
> ---------------------------------------------------------------------------
>
> Key: OPENJPA-284
> URL: https://issues.apache.org/jira/browse/OPENJPA-284
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc
> Affects Versions: 1.0.0
> Environment: Window XP, JDK 1.5
> Reporter: Teresa Kan
> Attachments: OPENJPA-284.patch
>
>
> When I tested the GeneratedValue strategy on TABLE, and I found a bug in the TableJDBCSeq that did not set the InitalValue. Therefore, the sequence always start from 1.
> Here are the bugs in the TableJDBCSeq:
> 1) InsertSequence method:
> SQLBuffer insert = new SQLBuffer(dict).append("INSERT INTO ").
> append(_pkColumn.getTable()).append(" (").
> append(_pkColumn).append(", ").append(_seqColumn).
> append(") VALUES (").
> appendValue(pk, _pkColumn).append(", ").
> appendValue(Numbers.valueOf(1), _seqColumn).append(")"); --> Always set the initial value to 1.
> 2) no getter and setter on the InitialValue.
> Here is the annotation:
> @TableGenerator(name="Dog_Gen", table ="ID_Gen", pkColumnName="GEN_NAME", valueColumnName="GEN_VAL",pkColumnValue="ID2",initialValue=20,allocationSize=10)
> @GeneratedValue(strategy=GenerationType.TABLE, generator="Dog_Gen")
> private int id2;
> The initial value always started from 1 with the current openjpa implementation.
> The fix will be like this:
> 1) add getter and setter of InitialValue in TableJDBCSeq .
> 2) add int _initValue variable.
> 3) Change the InsertSequence method:
> SQLBuffer insert = new SQLBuffer(dict).append("INSERT INTO ").
> append(_pkColumn.getTable()).append(" (").
> append(_pkColumn).append(", ").append(_seqColumn).
> append(") VALUES (").
> appendValue(pk, _pkColumn).append(", ").
> appendValue(_intValue, _seqColumn).append(")"); ---> change to use the initValue instead of 1.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (OPENJPA-284) TableJDBCSeq for GeneratedValue.TABLE
did not handle initialValue correctly
Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Dick closed OPENJPA-284.
--------------------------------
> TableJDBCSeq for GeneratedValue.TABLE did not handle initialValue correctly
> ---------------------------------------------------------------------------
>
> Key: OPENJPA-284
> URL: https://issues.apache.org/jira/browse/OPENJPA-284
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc
> Affects Versions: 1.0.0
> Environment: Window XP, JDK 1.5
> Reporter: Teresa Kan
> Fix For: 1.0.0
>
> Attachments: OPENJPA-284.patch
>
>
> When I tested the GeneratedValue strategy on TABLE, and I found a bug in the TableJDBCSeq that did not set the InitalValue. Therefore, the sequence always start from 1.
> Here are the bugs in the TableJDBCSeq:
> 1) InsertSequence method:
> SQLBuffer insert = new SQLBuffer(dict).append("INSERT INTO ").
> append(_pkColumn.getTable()).append(" (").
> append(_pkColumn).append(", ").append(_seqColumn).
> append(") VALUES (").
> appendValue(pk, _pkColumn).append(", ").
> appendValue(Numbers.valueOf(1), _seqColumn).append(")"); --> Always set the initial value to 1.
> 2) no getter and setter on the InitialValue.
> Here is the annotation:
> @TableGenerator(name="Dog_Gen", table ="ID_Gen", pkColumnName="GEN_NAME", valueColumnName="GEN_VAL",pkColumnValue="ID2",initialValue=20,allocationSize=10)
> @GeneratedValue(strategy=GenerationType.TABLE, generator="Dog_Gen")
> private int id2;
> The initial value always started from 1 with the current openjpa implementation.
> The fix will be like this:
> 1) add getter and setter of InitialValue in TableJDBCSeq .
> 2) add int _initValue variable.
> 3) Change the InsertSequence method:
> SQLBuffer insert = new SQLBuffer(dict).append("INSERT INTO ").
> append(_pkColumn.getTable()).append(" (").
> append(_pkColumn).append(", ").append(_seqColumn).
> append(") VALUES (").
> appendValue(pk, _pkColumn).append(", ").
> appendValue(_intValue, _seqColumn).append(")"); ---> change to use the initValue instead of 1.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.