Sandbox: Integrating The New Conversion Framework Into The Entity Engine
------------------------------------------------------------------------ Key: OFBIZ-3245 URL: https://issues.apache.org/jira/browse/OFBIZ-3245 Project: OFBiz Issue Type: Improvement Components: framework Affects Versions: SVN trunk Reporter: Adrian Crum Assignee: Adrian Crum Priority: Minor Attachments: conversion.patch This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-3245: ------------------------------- Attachment: conversion.patch The attached patch integrates the new conversion code into the entity engine. The patch is a work in progress, so it isn't finished yet - I still need to do some cleanups and finish the JavaDocs. It would really help if other developers could try out the patch with various databases to insure compatibility. I have tested it with Derby and Advantage. I would like for it to be tested with MySql and Postgres. Any help in this area would be greatly appreciated! Just apply the patch and run ant run-install. Check the log for any exceptions. Report any exceptions in this issue. Summary Using the converters with values retrieved from the database was easy - because the ResultSet can be queried for the object type of the field. Getting the converters to work when setting a value is tricky - because there is no easy way to know what object type the JDBC driver is expecting. There is a way to get that information from the PreparedStatement, but that method was introduced in JDBC 3, and not all drivers support JDBC 3. The solution I came up with was to create an entity with every field type in it (EntityDataTypes). When the ModelFieldType objects are created, the EntityDataTypes entity is queried, and the information contained in the returned ResultSet is used to set up the correct object types for that JDBC driver. It looks like a kludge, but it is the only way I could come up with to create accurate conversions for any database. This change might improve throughput - because the get and store operations are more direct - so there is no navigating long switch statements and additional conditional code. Comments and suggestions are welcome! > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781047#action_12781047 ] Scott Gray commented on OFBIZ-3245: ----------------------------------- Hi Adrian Looks like the patch is missing a couple of classes: SqlTypes and SqlObjectHandler. Regards Scott > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-3245: ------------------------------- Attachment: conversion.patch Updated patch includes missing file. Thanks Scott! > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781089#action_12781089 ] David E. Jones commented on OFBIZ-3245: --------------------------------------- This is an interesting change. Just to clarify: this is a change in the way the Entity Engine works from an external (ie API usage). Previously the Entity Engine expected you to pass a valid data type, would warn you if it wasn't what was expected (according to the fieldtypes*.xml file that was active), and then pass it on as-is to the JDBC driver to handle, or to blow up on. After this change the Entity Engine will attempt to convert whatever is passed in to whatever the JDBC driver expects. Quick question: why not just convert to the java-type specified in the fieldtypes*.xml file? Performance comment: doing a data type check and possible data type conversion will always be slower than what was done before; on a side note long if/else blocks do take a number of operations to work through, but switch statements are as close to free as you can get in terms of performance (usually a single low-level operation to jump to the desired code block); either way the performance impact of this will be so small compared to more expensive operations that are commonly done, like serialization/network/deserialization that the JDBC driver and database have to do, that I wouldn't expect to see any noticeable difference in performance > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781091#action_12781091 ] Adrian Crum commented on OFBIZ-3245: ------------------------------------ David, Thank you so much for the review and comments! I will include them in whatever version makes its way into the trunk. You said: "Previously the Entity Engine expected you to pass a valid data type, would warn you if it wasn't what was expected (according to the fieldtypes*.xml file that was active), and then pass it on as-is to the JDBC driver to handle, or to blow up on." The change I'm trying to introduce is this: You can give the Entity Engine any Java data type, and it will attempt to get/store it. There is no need to "guess" what the driver expects. If the attempt fails, it is because the conversion is not logical, it is not because there is some preconceived idea of what is acceptable. As far as performance on switch statements is concerned, I have written C++ code that is similar and I'm pretty sure that complicated conditionals are not "free." I have not evaluated Java switch statements, so I might be wrong. By the way, what database did you evaluate this with? I need as much input as I can get. > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781101#action_12781101 ] Erwan de FERRIERES commented on OFBIZ-3245: ------------------------------------------- Hi Adrian, I've got this error on my machine : [java] 2009-11-22 09:20:31,391 (main) [ Converters.java:91 :WARN ] *** No converter found, converting from [B to java.sql.Blob. Please report this message to the developer community so a suitable converter can be created. *** [java] 2009-11-22 09:20:31,400 (main) [ModelFieldTypeReader.java:177:ERROR] [java] ---- exception report ---------------------------------------------------------- [java] Exception: java.lang.ClassNotFoundException [java] Message: No converter found for [B->java.sql.Blob [java] ---- stack trace --------------------------------------------------------------- [java] java.lang.ClassNotFoundException: No converter found for [B->java.sql.Blob [java] org.ofbiz.base.conversion.Converters.getConverter(Converters.java:97) [java] org.ofbiz.entity.jdbc.SqlTypes$HandlerDecorator.<init>(SqlTypes.java:202) [java] org.ofbiz.entity.jdbc.SqlTypes.toSqlObjectHandler(SqlTypes.java:126) [java] org.ofbiz.entity.model.ModelFieldTypeReader.initializeFieldTypes(ModelFieldTypeReader.java:175) [java] org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:269) [java] org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:43) [java] org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:25) [java] org.ofbiz.base.util.UtilObject.getObjectFromFactory(UtilObject.java:181) [java] org.ofbiz.entity.DelegatorFactory.getDelegator(DelegatorFactory.java:31) [java] org.ofbiz.entityext.data.EntityDataLoadContainer.start(EntityDataLoadContainer.java:229) [java] org.ofbiz.base.container.ContainerLoader.start(ContainerLoader.java:100) [java] org.ofbiz.base.start.Start.startStartLoaders(Start.java:271) [java] org.ofbiz.base.start.Start.startServer(Start.java:321) [java] org.ofbiz.base.start.Start.start(Start.java:325) [java] org.ofbiz.base.start.Start.main(Start.java:410) [java] -------------------------------------------------------------------------------- [java] > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781285#action_12781285 ] David E. Jones commented on OFBIZ-3245: --------------------------------------- In C++ or Java switch statements are pretty close to free... but I'm not sure what you mean by "complicated conditionals"... and if you mean a long series of switch statements then those are certainly more expensive, especially if each if clause involved a significant compare or prepare/compare operation. Still, it is nearly nothing compared to other things that impact performance more. It's not like we're writing something to go through millions of data points already loaded into memory... No, I haven't tried to run it. > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781470#action_12781470 ] Adrian Crum commented on OFBIZ-3245: ------------------------------------ David, I re-read your initial comment and you are correct - this change will affect things from the API point of view. Actually, that was my original goal. The Java type specified in the fieldtypes*.xml files must be a Java class that the JDBC driver recognizes, otherwise an exception will be thrown. Let's say we want to add a new Java object type to the framework - like the TimeDuration that I'm trying get implemented. In the existing code, having something like {code} <field-type-def type="duration" sql-type="NUMERIC(20,0)" java-type="TimeDuration"></field-type-def> {code} won't work because the JDBC driver doesn't know what to do with a TimeDuration Java object type. Like you said, the TimeDuration object is passed to the JDBC driver as-is, and the result is it blows up. So, this change will make the entity engine more flexible, more adaptable. Users will be able to introduce their own data types without having to change entity engine Java code. > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781684#action_12781684 ] Adrian Crum commented on OFBIZ-3245: ------------------------------------ Erwan, The exception you reported was expected, because no Blob converters were developed. It should work with rev 883529. What database did you use? > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781836#action_12781836 ] Erwan de FERRIERES commented on OFBIZ-3245: ------------------------------------------- Adrian, i'm working on a postgres databas, using java 1.6. But I will try with your update, during the day. Cheers, > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781999#action_12781999 ] Erwan de FERRIERES commented on OFBIZ-3245: ------------------------------------------- I've got this error : [java] 2009-11-24 16:31:24,812 (main) [ModelFieldTypeReader.java:131:ERROR] [java] ---- exception report ---------------------------------------------------------- [java] SELECT * FROM OFBIZ.ENTITY_DATA_TYPES statement failed: [java] Exception: org.ofbiz.entity.GenericDataSourceException [java] Message: SQL Exception while executing the following:SELECT * FROM OFBIZ.ENTITY_DATA_TYPES (Table/View 'OFBIZ.ENTITY_DATA_TYPES' does not exist.) [java] ---- cause --------------------------------------------------------------------- [java] Exception: java.sql.SQLSyntaxErrorException [java] Message: Table/View 'OFBIZ.ENTITY_DATA_TYPES' does not exist. [java] ---- cause --------------------------------------------------------------------- [java] Exception: org.apache.derby.impl.jdbc.EmbedSQLException [java] Message: Table/View 'OFBIZ.ENTITY_DATA_TYPES' does not exist. [java] ---- cause --------------------------------------------------------------------- [java] Exception: org.apache.derby.iapi.error.StandardException [java] Message: Table/View 'OFBIZ.ENTITY_DATA_TYPES' does not exist. [java] ---- stack trace --------------------------------------------------------------- [java] ERROR 42X05: Table/View 'OFBIZ.ENTITY_DATA_TYPES' does not exist. [java] org.apache.derby.iapi.error.StandardException.newException(Unknown Source) [java] org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown Source) [java] org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown Source) [java] org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source) [java] org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown Source) [java] org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown Source) [java] org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source) [java] org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown Source) [java] org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source) [java] org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source) [java] org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source) [java] org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source) [java] org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source) [java] org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source) [java] org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown Source) [java] org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source) [java] org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source) [java] org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source) [java] org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:291) [java] org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:291) [java] org.ofbiz.entity.jdbc.SQLProcessor.prepareStatement(SQLProcessor.java:365) [java] org.ofbiz.entity.jdbc.SQLProcessor.prepareStatement(SQLProcessor.java:342) [java] org.ofbiz.entity.model.ModelFieldTypeReader.initializeFieldTypes(ModelFieldTypeReader.java:125) [java] org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:269) [java] org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:43) [java] org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:25) [java] org.ofbiz.base.util.UtilObject.getObjectFromFactory(UtilObject.java:181) [java] org.ofbiz.entity.DelegatorFactory.getDelegator(DelegatorFactory.java:31) [java] org.ofbiz.entityext.data.EntityDataLoadContainer.start(EntityDataLoadContainer.java:229) [java] org.ofbiz.base.container.ContainerLoader.start(ContainerLoader.java:100) [java] org.ofbiz.base.start.Start.startStartLoaders(Start.java:271) [java] org.ofbiz.base.start.Start.startServer(Start.java:321) [java] org.ofbiz.base.start.Start.start(Start.java:325) [java] org.ofbiz.base.start.Start.main(Start.java:410) [java] -------------------------------------------------------------------------------- [java] and some [java] 2009-11-24 16:58:16,549 (main) [ SqlJdbcUtil.java:510:INFO ] Unable to convert, falling back on switch statement [java] 2009-11-24 16:58:16,550 (main) [ SqlJdbcUtil.java:510:INFO ] Unable to convert, falling back on switch statement [java] 2009-11-24 16:58:16,550 (main) [ SqlJdbcUtil.java:510:INFO ] Unable to convert, falling back on switch statement HTH, Erwan > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782001#action_12782001 ] Adrian Crum commented on OFBIZ-3245: ------------------------------------ Did you run ant run-install? > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782004#action_12782004 ] Erwan de FERRIERES commented on OFBIZ-3245: ------------------------------------------- yes, it was during the run-install. When I ran it with a derby database, no problem. But this error comes when I use the posgres driver > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782101#action_12782101 ] David E. Jones commented on OFBIZ-3245: --------------------------------------- Looking at the patch there isn't anything that populates the EntityDataTypes entity, which may be related to the problem Erwan is seeing. I was looking at to see more about this idea of storing data types in the database... which I really don't like. That is a framework/technical level configuration and IMO it belongs in a file, NOT in the database. > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782107#action_12782107 ] Adrian Crum commented on OFBIZ-3245: ------------------------------------ David, I agree. Like I said, it looks like a kludge. I'm sure you are aware that different database vendors are going to use different Java object types for fields, plus different vendors have different levels of JDBC support. If you know of a better way to determine a driver's choice of object type for a particular field, then please share it. > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782130#action_12782130 ] David E. Jones commented on OFBIZ-3245: --------------------------------------- Mainly just put it in a file instead of in the db. Also though, consider using what has been used in OFBiz since the beginning, and what everyone is used to: the fieldtypes*.xml files. > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782140#action_12782140 ] Adrian Crum commented on OFBIZ-3245: ------------------------------------ Okay, how about a sql-object-type attribute? The current sql-type attribute contains the type needed for a CREATE statement, and what I need is the Java object type the database vendor uses to represent it. For example, Derby uses BigDecimal for the numeric type, so it would look something like: {code} <field-type-def type="numeric" sql-type="NUMERIC(20,0)" sql-object-type="BigDecimal" java-type="Long"></field-type-def> {code} I could set it up as an optional attribute. In the absence of the sql-object-type attribute, the java-type attribute will be used. The duration type would look like: {code} <field-type-def type="duration" sql-type="NUMERIC(20,0)" sql-object-type="BigDecimal" java-type="TimeDuration"></field-type-def> {code} What do you think? > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-3245: ------------------------------- Attachment: conversion.patch Updated patch based on David's suggestion. fieldtypes*.xml files now accept a sql-object-type attribute. I updated the fieldtypesadvantage.xml file to demonstrate the difference. > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782321#action_12782321 ] David E. Jones commented on OFBIZ-3245: --------------------------------------- Actually the java-type IS the object that the database driver expects. Historically it has only been used to check the incoming type and log a warning if they are different. Why not just use the java-type attribute instead of introducing a new one? Or, on the other hand, if the sql-object-type is what the conversion code will use, then what will the java-type be used for? Or am I getting this backward? > Sandbox: Integrating The New Conversion Framework Into The Entity Engine > ------------------------------------------------------------------------ > > Key: OFBIZ-3245 > URL: https://issues.apache.org/jira/browse/OFBIZ-3245 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: Adrian Crum > Assignee: Adrian Crum > Priority: Minor > Attachments: conversion.patch, conversion.patch, conversion.patch > > > This issue contains a patch intended for evaluation before it is committed. See comments for details. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
Free forum by Nabble | Edit this page |