[ 
https://issues.apache.org/jira/browse/OPENJPA-2387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13722862#comment-13722862
 ] 

ASF subversion and git services commented on OPENJPA-2387:
----------------------------------------------------------

Commit 1508184 from [~jpaheath] in branch 'openjpa/branches/2.2.x'
[ https://svn.apache.org/r1508184 ]

OPENJPA-2387: Fix to exclude schema name when checking the length of a sequence 
name.  Made update to ensure schema is used after length is calculated.
                
> Schema name is incorrectly included in length of Sequence name.
> ---------------------------------------------------------------
>
>                 Key: OPENJPA-2387
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2387
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.3.0, 2.2.2, 2.2.1.1
>            Reporter: Heath Thomann
>            Assignee: Heath Thomann
>         Attachments: OPENJPA-2387-2.2.1.x.patch
>
>
> Take the following entity definition:
> @Entity @Table(name="LONG_NAME_ENTITY")
> @SequenceGenerator(name="longSequenceNameSequence",sequenceName="A_TWENTY_NINE_CHAR_LENGTH_SEQ")
> public class LongSequenceNameEntity implements Serializable
> As can be seen, a Sequence is defined with a name which is 29 characters 
> long.  On a Database such as Oracle which has a 30 character limit on 
> sequence names, among others names, this sequence is perfectly legal.  
> However, when a schema name is tacked onto this by OpenJPA, OpenJPA code 
> incorrectly counts the characters of the schema in the length of the sequence 
> name.   As such, the following exception will occur:
> Caused by: <openjpa-2.2.1.1-SNAPSHOT-r422266:1445654M nonfatal user error> 
> org.apache.openjpa.persistence.ArgumentException: Sequence name 
> "HTHOMANN.A_TWENTY_NINE_CHAR_LENGTH_SEQ" is 38-character long. The database 
> allows maximum 30-character for a sequence name.
>       at 
> org.apache.openjpa.jdbc.sql.DBDictionary.checkNameLength(DBDictionary.java:5358)
>       at 
> org.apache.openjpa.jdbc.sql.DBDictionary.commonCreateAlterSequenceSQL(DBDictionary.java:3492)
>       at 
> org.apache.openjpa.jdbc.sql.DBDictionary.getAlterSequenceSQL(DBDictionary.java:3469)
> The DBDictionary.checkNameLength in this case is counting the characters of 
> the schema name, and sequence name.  The length of the schema name should not 
> be included in the length of the sequence.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to