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

@TypeDef not working properly #28

Open
A1016375 opened this issue Jun 6, 2024 · 5 comments
Open

@TypeDef not working properly #28

A1016375 opened this issue Jun 6, 2024 · 5 comments
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers

Comments

@A1016375
Copy link

A1016375 commented Jun 6, 2024

Original Code:

@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)

@Type(type = "json")
	@Column(name = "branding_json", columnDefinition = "json")
	private JSONObject branding_json;

After openrewrite Upgrade

@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)

**@Type(jsonb.class)** <-- Giving Error
	@Column(name = "branding_json", columnDefinition = "json")
	private JSONObject branding_json;

Excepted Changes

@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class) **<-- This line should be removed**

**@Type(JsonBinaryType.class)** **<-- This line should be** 
	@Column(name = "branding_json", columnDefinition = "json")
	private JSONObject branding_json;
@A1016375 A1016375 added the bug Something isn't working label Jun 6, 2024
@timtebeek timtebeek added the enhancement New feature or request label Jun 6, 2024
@timtebeek timtebeek moved this to Backlog in OpenRewrite Jun 6, 2024
@timtebeek
Copy link
Contributor

Thanks for the report @A1016375 ! Indeed not covered yet, although at first glance it seems doable. Is this something you'd want to help add to the recipe module?

@abccbaandy
Copy link

abccbaandy commented Jun 11, 2024

Not sure if same issue.

uuid migrate is wrong too.

before

    @Type(type = "uuid-char")

after

    @Type(uuid-char.class)

uuid-char.class is not even exist

According to this link, should be

    @JdbcTypeCode(java.sql.Types.VARCHAR)

@timtebeek
Copy link
Contributor

Thanks for chiming in @abccbaandy ; this would be another special case to handle, similar as how we've covered temporal types:

Welcome to push up a draft with a failing test and then we'll work out the next steps from there.

@timtebeek timtebeek added the good first issue Good for newcomers label Oct 21, 2024
@BrayanMnz
Copy link

What are the plans on this? @timtebeek

Should someone add a recipe to update @typedef to @convert with the right attribute names?

I would love to take a look at it and help with the fix

@timtebeek
Copy link
Contributor

hi @BrayanMnz ; great seeing you here! Yes help would be much appreciated; if you push up a draft PR with only additional tests I can assign the issue to you and work from there. The example linked above should help as a hint for the implementation, but just a draft PR with tests helps to give early feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers
Projects
Status: Backlog
Development

No branches or pull requests

4 participants