There is no enun in ofbiz, but my database uses it.
For example there is a field named "test" in the table enum_test and it's type
is enum('one','two','three').
In entitymodel.xml
<entity entity-name="EnmuTest"
package-name="com.aicent.ccb"
title="test enum type in mysql">
<field name="id" type="id" />
<field name="test" type="enumtest" />
<prim-key field="id" />
</entity>
Field test's type is enumtest.
In fieldtypemysql.xml
<field-type-def type="enumtest" sql-type="enum('one','two','three')"
java-type="String[]"></field-type-def>
Then I execute command "ant run-install" in root directory of ofbiz.
It creates table enum_test successfully but when I start ofbiz
There are two errors:
2009-02-11 16:38:49,452 (main) [ DatabaseUtil.java:988:INFO ] Getting
Column Info From Database
2009-02-11 16:38:49,577 (main) [ DatabaseUtil.java:236:ERROR]
---- runtime exception report --------------------------------------------------
Exception: java.lang.NumberFormatException
Message: For input string: "'one'"
---- stack trace ---------------------------------------------------------------
java.lang.NumberFormatException: For input string: "'one'"
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
java.lang.Integer.parseInt(Integer.java:447)
java.lang.Integer.parseInt(Integer.java:497)
org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:234)
org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:125)
org.ofbiz.entity.datasource.GenericDAO.checkDb(GenericDAO.java:1099)
org.ofbiz.entity.datasource.GenericHelperDAO.checkDataSource(GenericHelperDAO.java:198)
org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:185)
org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.java:117)
org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.java:165)
org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.java:141)
org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
org.ofbiz.base.start.Start.init(Start.java:87)
org.ofbiz.base.start.Start.main(Start.java:403)
--------------------------------------------------------------------------------
2009-02-11 16:38:49,577 (main) [ DatabaseUtil.java:243:ERROR]
---- runtime exception report --------------------------------------------------
Exception: java.lang.NumberFormatException
Message: For input string: "'two','three'"
---- stack trace ---------------------------------------------------------------
java.lang.NumberFormatException: For input string: "'two','three'"
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
java.lang.Integer.parseInt(Integer.java:447)
java.lang.Integer.parseInt(Integer.java:497)
org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:241)
org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:125)
org.ofbiz.entity.datasource.GenericDAO.checkDb(GenericDAO.java:1099)
org.ofbiz.entity.datasource.GenericHelperDAO.checkDataSource(GenericHelperDAO.java:198)
org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:185)
org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.java:117)
org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.java:165)
org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.java:141)
org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
org.ofbiz.base.start.Start.init(Start.java:87)
org.ofbiz.base.start.Start.main(Start.java:403)
---------------------------------------------------------------------------
How should I solve this problem?
Thank you all!
-----Original Message-----
From: BJ Freeman [mailto:[email protected]]
Sent: 2009年2月10日 21:24
To: [email protected]
Subject: Re: Does OFBiz support mysql data type enum?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
not sure what you are asking
where did you find enum in the file?
Jack Liu sent the following on 2/10/2009 5:04 AM:
> I knew that, but did you test it for data type enum in mysql?
>
> -----Original Message-----
> From: BJ Freeman [mailto:[email protected]]
> Sent: 2009年2月10日 19:46
> To: [email protected]
> Subject: Re: Does OFBiz support mysql data type enum?
>
> type of fields used for a specific DB is found in
> /framework/entity/fieldtypes/
>
> Jack Liu sent the following on 2/10/2009 12:13 AM:
>> Best Regards,
>
>> Jack Liu
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFJkX/xrP3NbaWWqE4RAtHgAJ9sRul4GLQjbiQULbbIoQZZtVH+KACfcZwM
3qlsZYqXj3Q/CJU/mAj6i1M=
=DKmP
-----END PGP SIGNATURE-----