-
Jan 21st, 2010, 08:27 PM
#1
Oracle issue based on a field named 'number'
FYI... I made the switch from my desktop MySql database to our oracle RAC environment and noticed that Oracle has issues with the fieldname 'number'.
1) Here is the roo script
project --topLevelPackage com.test.app
// Database configuration -- ORACLE
persistence setup --provider HIBERNATE --database ORACLE
database properties set --key database.url --value jdbc: oracle:thin:@ldap://abc0:389/rac_svc,cn=OracleContext ldap://abc1:389/rac_svc,cn=OracleContext
database properties set --key database.username --value username
database properties set --key database.password --value password
entity --class ~.resource.TelephoneNumber --testAutomatically
field string --fieldName countryCode --sizeMax 5
field string --fieldName areaCode --sizeMax 5
field string --fieldName number --sizeMax 5
field string --fieldName type --sizeMax 20
field string --fieldName title --sizeMax 100
field boolean --fieldName archive
controller all --package ~.web
security setup
logging setup --level DEBUG
RESULT:
Everything appears to have been generated... but... the database table creation actually fails.
ERRORS:
2010-01-22 14:26:17,218 [main] DEBUG org.springframework.beans.factory.wiring.BeanConfi gurerSupport - Failed to create target bean 'entityMa
nagerFactory' while configuring object of type [domain.TelephoneNumber] - probably due to a circular reference. This is a
common startup situation and usually not fatal. Proceeding without injection. Original exception: org.springframework.beans.factory.BeanCrea
tionException: Error creating bean with name 'domain.TelephoneNumber': Injection of persistence dependencies failed; neste
d exception is org.springframework.beans.factory.BeanCurrentlyInC reationException: Error creating bean with name 'entityManagerFactory': Fac
toryBean which is currently in creation returned null from getObject
2010-01-22 14:26:18,921 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Unsuccessful: create table telephone_number (id number(19,0)
not null, version number(10,0), archive number(1,0), area_code varchar2(255), country_code varchar2(255), number varchar2(255), title varcha
r2(255), type varchar2(255), primary key (id))
2010-01-22 14:26:18,921 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - ORA-00904: : invalid identifier
2010-01-22 14:26:18,921 [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport - alter table organisation_telephone_numbers add constraint FKA
5EBCCEA74D35511 foreign key (telephone_numbers) references telephone_number
2010-01-22 14:26:18,937 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Unsuccessful: alter table organisation_telephone_numbers add
constraint FKA5EBCCEA74D35511 foreign key (telephone_numbers) references telephone_number
2010-01-22 14:26:18,937 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - ORA-00942: table or view does not exist
FIX:
Instead of
field string --fieldName number --sizeMax 5
Do something like:
field string --fieldName telephoneNumber --sizeMax 5
-
Jan 22nd, 2010, 02:07 AM
#2
Thanks for this info. Since number seems to be a reserved word in Oracle, I think it makes sense to add it to our list of reserved words for the field command. Can you please open a Jira ticket on this?
Thanks, Stefan
-
Jan 22nd, 2010, 03:44 PM
#3
-
Jan 22nd, 2010, 04:25 PM
#4
Enhancement completed in SVN rev 578. Will be in Roo 1.0.1.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules