I can't say I remember, but if you look in adaptorValueByConvertingAttributeValue on EOAttribute in ERAttributeExtension, there's a bit at the end of the method where I let the date types slide by to support Joda dates. You may have to add support for it there, as that is where your exception appears to be emanating from. ________________________________ From: Paul Hoadley via Webobjects-dev <webobjects-dev@lists.apple.com> Sent: Tuesday, November 1, 2022 10:43 PM To: WebObjects-Dev List <webobjects-dev@lists.apple.com> Subject: Custom array column types in EO model
Hello, I'm trying to get this to work for PostgreSQL, though I suspect it would be similar for any RDBMS that offered a type like "text[]": https://www.postgresql.org/docs/current/arrays.html<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.postgresql.org%2Fdocs%2Fcurrent%2Farrays.html&data=05%7C01%7Cramsey.gurley%40practicemojo.com%7Cc1b9a30d9f6343ee9f1008dabc9530ad%7Cde0a512999d34d35a92809047a134775%7C1%7C0%7C638029646218988341%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=1zm7UcuY5fc9VNsK5UTok%2FUthdT0zyL7lK7HOq8Ix9Y%3D&reserved=0> Ideally, I'd like to map an NSArray<String> attribute on the model side to a text[] column in Postgres, though any variation on this would be a good start. I can't quite get there, even with the smarts added by ERAttributeExtension. This is as close as I can get: { adaptorValueConversionClassName = "net.logicsquad.woextensions.eof.LSValueConversion"; adaptorValueConversionMethodName = stringArrayToPostgreSQLTextArray; allowsNull = Y; columnName = "metadata_key_list"; externalType = anyarray; name = metadataKeyList; valueClassName = "com.webobjects.foundation.NSArray"; valueFactoryClassName = "net.logicsquad.woextensions.eof.LSValueConversion"; valueFactoryMethodName = arrayToStringArray; }, I'm only working on the output side for the minute. LSValueConversion. stringArrayToPostgreSQLTextArray(NSArray<String>) returns a subclass of java.sql.Array, which I assume is what the Postgres JDBC driver wants. However, when I try to save an object, it's EOAttribute that complains: [2022-11-2 5:31:59 UTC] <main> com.webobjects.eoaccess.EOGeneralAdaptorException: EOAttribute adaptorValueByConvertingAttributeValue(Object): Unable to convert value of class net.logicsquad.woextensions.eof.PostgresqlTextArray for attribute 'metadataKeyList' in entity 'DocumentVersion' to adaptor type EOAttribute.AdaptorBytesType. Check the signature of the conversion method com.webobjects.foundation.NSArray.stringArrayToPostgreSQLTextArray(). To my eye, that's suggesting that the conversion method is not producing an object of type "bytes", which is true enough—it's a subclass of java.sql.Array. It doesn't help to comment out the part of EOAttribute that's throwing that exception, either: 2022-11-02 05:40:58.728 WARN NSLog - A fatal exception occurred: Unable to create a byte representation for class "net.logicsquad.woextensions.eof.PostgresqlTextArray" At this point I'm out of ideas. Has anyone done this or anything like it? -- Paul Hoadley https://logicsquad.net/<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flogicsquad.net%2F&data=05%7C01%7Cramsey.gurley%40practicemojo.com%7Cc1b9a30d9f6343ee9f1008dabc9530ad%7Cde0a512999d34d35a92809047a134775%7C1%7C0%7C638029646218988341%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2FOeU7BTGMvw7tM1gbMkB73QMCiQHZAHYX3h54OGF6wY%3D&reserved=0> https://www.linkedin.com/company/logic-squad/ ________________________________ Confidentiality Notice: This email, including all attachments and replies thereto, are covered by the Electronic Communications Privacy Act, 18 U.S.C. Sections 2510-2521 and are legally privileged. This information is confidential, and intended only for the use of the individuals or entities named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this transmitted information is strictly prohibited. Please notify us if you have received this transmission in error. Thank you.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com