Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348181 - ddl generation @Column - length attribute ignored if updatable=false,insertable=false
Summary: ddl generation @Column - length attribute ignored if updatable=false,insertab...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-03 05:17 EDT by TimM CLA
Modified: 2022-06-09 10:25 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description TimM CLA 2011-06-03 05:17:48 EDT
Build Identifier: 2.2.0.v20110202-r8913

if I have for eg

@Entity
@Table(name="COREPMA")
public class Parameter {
	@Id
	@Column(name=BlockDeblock.KEY, length=47)	
	private String key ;
	
	@Column(name=BlockDeblock.DATA,  length=4000, insertable=false,updatable=false)
	private String data ;
}
then the ddl generated uses the default length (255)
[EL Fine]: 2011-06-03 09:05:57.021--ServerSession(16135119)--Connection(14145720)--Thread(Thread[Main Thread,5,main])--CREATE TABLE COREPMA (ORA2_KEY VARCHAR(47) NOT NULL, ORA2_DATA VARCHAR(255), PRIMARY KEY (ORA2_KEY))
if i remove the insertable=false,updatable= false then it produces
CREATE TABLE COREPMA (ORA2_KEY VARCHAR(47) NOT NULL, ORA2_DATA VARCHAR(4000), PRIMARY KEY (ORA2_KEY))
nb the length is now correct.
I can't really think of any valid reason why ?
This means that when running tests against hsqldb 2.2.2 that we can not insert test data into that table via sql over 255 chars long.

Reproducible: Always
Comment 1 TimM CLA 2011-06-03 05:30:39 EDT
The same occurs in build 2.3.0.v20110516-r9382
Comment 2 TimM CLA 2011-06-06 05:26:05 EDT
it appears a workaround is to specifiy the columnDefinition attribute 
eg @Column(name=BlockDeblock.DATA, insertable=false,updatable=false, length=4000, columnDefinition="VARCHAR(4000)")
	private String data ;

Although this is far from ideal as we have about 300 fields specified as insertable=false,updatable=false
Comment 3 Tom Ware CLA 2011-06-16 14:17:18 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:25:16 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink