Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String type and db type #52

Open
olivermt opened this issue Sep 29, 2014 · 4 comments
Open

String type and db type #52

olivermt opened this issue Sep 29, 2014 · 4 comments

Comments

@olivermt
Copy link

Hi.

ArrayType with String becomes varchar[] now, where would I look to be able to get it to be text instead?

I have "user-type" type: org.hibernate.type.TextType, class: String in my gorm default mappings, but this does not seem to be used by the plugin.

@ilopmar
Copy link
Collaborator

ilopmar commented Sep 29, 2014

Hi!

As you can see in the dialect file, the string array is mapped with varchar: https://github.com/kaleidos/grails-postgresql-extensions/blob/master/src/java/net/kaleidos/hibernate/PostgresqlExtensionsDialect.java#L27

You can subclass the dialect an override the definition of the array type for strings to use text instead of varchar.

Please let me know if this works for you.

@ilopmar
Copy link
Collaborator

ilopmar commented Sep 29, 2014

Or even better, we could create a new TEXT_ARRAY that use text instead of varchar.

@Alotor, what do you think?

@olivermt
Copy link
Author

It doesn't really matter I think, the implementation behind the scenes is 100% identical for varchar and text, and varchar[] gives a non-limited per-string size, so any kind of change should not be able to make a difference.

I am not going to close the issue if you want to keep discussing, but consider me satisfied.

Great plugin by the way! :)

Crossing my fingers that some of you might need postgis and add that to the database as well ;)

@Alotor
Copy link
Member

Alotor commented Oct 1, 2014

I think maybe we can add an additional parameter to support text arrays. For example:

stringArray type:ArrayType, params: [type: String, asText: true]

I think this is cleaner and easier 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants