Re: Custom array column types in EO model
Re: Custom array column types in EO model
- Subject: Re: Custom array column types in EO model
- From: Paul Hoadley via Webobjects-dev <email@hidden>
- Date: Thu, 3 Nov 2022 15:18:35 +1030
- Feedback-id: i671c40f3:Fastmail
Hi Jürgen,
That was one of the first things I tried—formatting the array as PostgreSQL
would expect to see it via, say, psql and then just trying to ram it through!
As with other approaches I've tried, it gets you close, but not quite there.
Firstly:
2022-11-03 04:41:37.922 WARN NSLog - *** JDBCAdaptor : no type info found for
text[]
Doesn't seem to like "text[]" as an external type, though I am not sure how
important that is. And then:
EOGeneralAdaptorException: EvaluateExpression failed:
<com.webobjects.jdbcadaptor.PostgresqlExpression: "UPDATE ...
Next exception:SQL State:42846 -- error code: 0 -- msg: ERROR: cannot cast
type bytea to text[]
On 3 Nov 2022, at 00:21, Jürgen Tabert <email@hidden> wrote:
> Maybe you should try the easy way.
> The data type text[] requires curly brackets.
>
> Q&D
>
> public static String postgesqlTextArrayFromNSArray(NSArray<String>
> stringArray) {
> StringJoiner sj = new StringJoiner(",", "{", "}");
> for (String s : stringArray) {
> sj.add(s);
> }
> return sj.toString();
> }
>
> {
> adaptorValueConversionClassName =
> "de.htgreenline.divas.prototypes.ValueConversion";
> adaptorValueConversionMethodName = postgesqlTextArrayFromNSArray;
> columnName = newAttribute;
> externalType = "text[]";
> factoryMethodArgumentType = EOFactoryMethodArgumentIsNSString;
> name = newAttribute;
> valueClassName = "com.webobjects.foundation.NSArray";
> valueFactoryClassName = "de.htgreenline.divas.prototypes.ValueFactory";
> valueFactoryMethodName = stringArrayFromTextArray;
> }
--
Paul Hoadley
https://logicsquad.net/
https://www.linkedin.com/company/logic-squad/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden