Ken Rimple
Chariot Solutions
email: krimple@chariotsolutions.com
work: www.chariotsolutions.com/education
personal: www.rimple.com
Author: Spring Roo in Action (Manning)
MEAP Site: manning.com/rimple
Seems like this is the bottle neck. My database column net_package_id is defined as char [32]. What do I need to define the type in spring hibernate to map to this field.
Caused by: org.hibernate.HibernateException: Wrong column type in DBA.NET_PACKAGE for column net_package_id. Found: char, expected: varchar2(255 char)
at org.hibernate.mapping.Table.validateColumns(Table. java:283)
at org.hibernate.cfg.Configuration.validateSchema(Con figuration.java:1313)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validat e(SchemaValidator.java:139)
at org.hibernate.impl.SessionFactoryImpl.<init>(Sessi onFactoryImpl.java:376)
at org.hibernate.cfg.Configuration.buildSessionFactor y(Configuration.java:1842)
at org.hibernate.ejb.Ejb3Configuration.buildEntityMan agerFactory(Ejb3Configuration.java:902)
Hibernate seems to want to map primary keys that are string-based to varchar2 fields. It may not support fixed char fields. See this stack overflow (which was one of the few things I found when searching for you):
http://stackoverflow.com/questions/1...lumn-in-oracle
Here is another one that suggests subclassing the dialect to register the type (may not apply but gives you ideas)
http://stackoverflow.com/questions/2...defined-length
You have at least two options:
- convert the type to varchar2 (not likely in an existing database)
- create a Hibernate SqlType and use the @Type annotation to mark your primary key as that type - basically SqlTypes are converters to move in/out of Java classes.
You could probably even figure out a way to write a generator to generate the key for you. If you're really ambitious, look up the code behind the Hibernate support for UUIDs or even GUIDs - they are a Java datatype, and Hibernate supports them as a form of PK - I think they store in binary format but may be able to be stored in an encoded fixed-length char.
I'm sorry, I think this is something a bit harder but it's not Roo that is the issue here, it's Hibernate/JPA and a fixed-length PK that likely isn't an inbuilt feature.
Does anyone else have an idea on this?
Ken
Last edited by krimple; Jan 19th, 2011 at 05:36 AM.
Ken Rimple
Chariot Solutions
email: krimple@chariotsolutions.com
work: www.chariotsolutions.com/education
personal: www.rimple.com
Author: Spring Roo in Action (Manning)
MEAP Site: manning.com/rimple
Thanks ken. Now am getting below error or 'controller all - schema xxx' . The entities were generated using dbre. Any suggestions?
roo> controller all --package ~.web
Created SRC_MAIN_JAVA\com\roo\web
Created SRC_MAIN_JAVA\com\roo\web\IvpCustomerController.ja va
Created SRC_MAIN_WEBAPP\WEB-INF\spring
Created SRC_MAIN_WEBAPP\WEB-INF\spring\webmvc-config.xml
Created SRC_MAIN_JAVA\com\roo\web\ApplicationConversionSer viceFactoryBean.java
Updated SRC_MAIN_WEBAPP\WEB-INF\spring\webmvc-config.xml
Updated ROOT\pom.xml [Added dependency org.apache.tiles:tiles-core:2.2.1]
Updated ROOT\pom.xml [Added dependency org.apache.tiles:tiles-jsp:2.2.1]
Updated SRC_MAIN_WEBAPP\WEB-INF\spring\webmvc-config.xml
Created SRC_MAIN_WEBAPP\images
Created SRC_MAIN_WEBAPP\images\create.png
Created SRC_MAIN_WEBAPP\images\resultset_next.png
Created SRC_MAIN_WEBAPP\images\show.png
Created SRC_MAIN_WEBAPP\images\resultset_previous.png
Created SRC_MAIN_WEBAPP\images\delete.png
Created SRC_MAIN_WEBAPP\images\list.png
Created SRC_MAIN_WEBAPP\images\favicon.ico
Created SRC_MAIN_WEBAPP\images\resultset_last.png
Created SRC_MAIN_WEBAPP\images\resultset_first.png
Created SRC_MAIN_WEBAPP\images\springsource-logo.png
Created SRC_MAIN_WEBAPP\images\add.png
Created SRC_MAIN_WEBAPP\images\banner-graphic.png
Created SRC_MAIN_WEBAPP\images\update.png
Created SRC_MAIN_WEBAPP\styles
Created SRC_MAIN_WEBAPP\styles\standard.css
Created SRC_MAIN_WEBAPP\styles\alt.css
Created SRC_MAIN_WEBAPP\WEB-INF\classes
Created SRC_MAIN_WEBAPP\WEB-INF\classes\standard.properties
Created SRC_MAIN_WEBAPP\WEB-INF\classes\alt.properties
Created SRC_MAIN_WEBAPP\WEB-INF\layouts
Created SRC_MAIN_WEBAPP\WEB-INF\layouts\default.jspx
Created SRC_MAIN_WEBAPP\WEB-INF\layouts\layouts.xml
Created SRC_MAIN_WEBAPP\WEB-INF\views
Created SRC_MAIN_WEBAPP\WEB-INF\views\header.jspx
Created SRC_MAIN_WEBAPP\WEB-INF\views\footer.jspx
Created SRC_MAIN_WEBAPP\WEB-INF\views\views.xml
Created SRC_MAIN_WEBAPP\WEB-INF\views\index.jspx
Created SRC_MAIN_WEBAPP\WEB-INF\views\index-template.jspx
Created SRC_MAIN_WEBAPP\WEB-INF\views\resourceNotFound.jspx
Created SRC_MAIN_WEBAPP\WEB-INF\views\dataAccessFailure.jspx
Created SRC_MAIN_WEBAPP\WEB-INF\views\uncaughtException.jspx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\create.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\dependency.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\update.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\show.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\list.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\find.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\checkbox.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\reference.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\textarea.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\simple.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\datetime.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\input.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\editor.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\display.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\column.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\select.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\table.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\menu
Created SRC_MAIN_WEBAPP\WEB-INF\tags\util
Created SRC_MAIN_WEBAPP\WEB-INF\tags\util\placeholder.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\util\theme.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\util\language.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\util\pagination.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\util\panel.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\tags\util\load-scripts.tagx
Created SRC_MAIN_WEBAPP\WEB-INF\i18n
Created SRC_MAIN_WEBAPP\WEB-INF\i18n\messages.properties
Created SRC_MAIN_WEBAPP\images\en.png
Updated SRC_MAIN_WEBAPP\WEB-INF\views\footer.jspx
Updated SRC_MAIN_WEBAPP\WEB-INF\i18n\application.properties
Created SRC_MAIN_WEBAPP\WEB-INF\views\ivpcustomers
Created SRC_MAIN_WEBAPP\WEB-INF\views\ivpcustomers\list.jspx
Created SRC_MAIN_WEBAPP\WEB-INF\views\ivpcustomers\views.xml
Created SRC_MAIN_WEBAPP\WEB-INF\views\ivpcustomers\show.jspx
Updated SRC_MAIN_WEBAPP\WEB-INF\views\ivpcustomers\views.xml
Undo manage SRC_MAIN_WEBAPP\WEB-INF\views\ivpcustomers\views.xml
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\ivpcustomers\show.jspx
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\ivpcustomers\views.xml
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\ivpcustomers\list.jspx
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\ivpcustomers
Undo manage SRC_MAIN_WEBAPP\WEB-INF\i18n\application.properties
Undo create SRC_MAIN_WEBAPP\WEB-INF\i18n\application.properties
Undo manage SRC_MAIN_WEBAPP\WEB-INF\views\footer.jspx
Undo create SRC_MAIN_WEBAPP\images\en.png
Undo create SRC_MAIN_WEBAPP\WEB-INF\i18n\messages.properties
Undo create SRC_MAIN_WEBAPP\WEB-INF\i18n
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\util\load-scripts.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\util\panel.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\util\pagination.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\util\language.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\util\theme.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\util\placeholder.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\util
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\menu
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\table.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\select.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\column.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\display.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\editor.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\input.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\datetime.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\simple.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\textarea.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\reference.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields\checkbox.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\fields
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\find.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\list.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\show.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\update.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\dependency.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form\create.tagx
Undo create SRC_MAIN_WEBAPP\WEB-INF\tags\form
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\uncaughtException.jspx
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\dataAccessFailure.jspx
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\resourceNotFound.jspx
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\index-template.jspx
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\index.jspx
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\views.xml
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\footer.jspx
Undo create SRC_MAIN_WEBAPP\WEB-INF\views\header.jspx
Undo create SRC_MAIN_WEBAPP\WEB-INF\views
Undo create SRC_MAIN_WEBAPP\WEB-INF\layouts\layouts.xml
Undo create SRC_MAIN_WEBAPP\WEB-INF\layouts\default.jspx
Undo create SRC_MAIN_WEBAPP\WEB-INF\layouts
Undo create SRC_MAIN_WEBAPP\WEB-INF\classes\alt.properties
Undo create SRC_MAIN_WEBAPP\WEB-INF\classes\standard.properties
Undo create SRC_MAIN_WEBAPP\WEB-INF\classes
Undo create SRC_MAIN_WEBAPP\styles\alt.css
Undo create SRC_MAIN_WEBAPP\styles\standard.css
Undo create SRC_MAIN_WEBAPP\styles
Undo create SRC_MAIN_WEBAPP\images\update.png
Undo create SRC_MAIN_WEBAPP\images\banner-graphic.png
Undo create SRC_MAIN_WEBAPP\images\add.png
Undo create SRC_MAIN_WEBAPP\images\springsource-logo.png
Undo create SRC_MAIN_WEBAPP\images\resultset_first.png
Undo create SRC_MAIN_WEBAPP\images\resultset_last.png
Undo create SRC_MAIN_WEBAPP\images\favicon.ico
Undo create SRC_MAIN_WEBAPP\images\list.png
Undo create SRC_MAIN_WEBAPP\images\delete.png
Undo create SRC_MAIN_WEBAPP\images\resultset_previous.png
Undo create SRC_MAIN_WEBAPP\images\show.png
Undo create SRC_MAIN_WEBAPP\images\resultset_next.png
Undo create SRC_MAIN_WEBAPP\images\create.png
Undo create SRC_MAIN_WEBAPP\images
Undo manage SRC_MAIN_WEBAPP\WEB-INF\spring\webmvc-config.xml
Undo manage ROOT\pom.xml
Undo manage SRC_MAIN_WEBAPP\WEB-INF\spring\webmvc-config.xml
Undo create SRC_MAIN_JAVA\com\roo\web\ApplicationConversionSer viceFactoryBean.java
Undo create SRC_MAIN_WEBAPP\WEB-INF\spring\webmvc-config.xml
Undo create SRC_MAIN_WEBAPP\WEB-INF\spring
Undo create SRC_MAIN_JAVA\com\roo\web\IvpCustomerController.ja va
Undo create SRC_MAIN_JAVA\com\roo\web
UnsupportedOperationException at java.util.Collections$UnmodifiableCollection.add(C ollections.java:1018)
com.roo.web roo>