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

Add @DataObject for generated POJOs #140

Closed
zou8944 opened this issue Apr 2, 2020 · 6 comments
Closed

Add @DataObject for generated POJOs #140

zou8944 opened this issue Apr 2, 2020 · 6 comments
Milestone

Comments

@zou8944
Copy link

zou8944 commented Apr 2, 2020

It is perfect to generate POJO with fomJson and toJson, but is it possible to add @dataobject to generated POJOs also? if so , we can use it in service proxies. refer to Service proxies doc, the asynchronous result can only be primitive/json/enum, and class annotated with @dataobject

@jklingsporn
Copy link
Owner

This totally makes sense. Will see how fast I can add it.

@zou8944
Copy link
Author

zou8944 commented Apr 2, 2020

On the other hand, I noticed that the generated DAO classes have methods like findManyByxxx/findOneByxxx which accept Condition parameter. But I don't know how to add order by segment and execute complex queries like join, could you please advide ?

@jklingsporn
Copy link
Owner

I'd just add @DateObject-support for the POJOs for now.
Using DAOs via service proxies would be the next thing and out of the scope of this issue. What you can do for converting the Condition is to convert it into a String on one side and convert it back afterwards using DSL.condition(String) method.

@zou8944
Copy link
Author

zou8944 commented Apr 2, 2020

you mean this ?

contentDao.findManyByCondition(DSL.condition(CONTENT.ID.gt(begin).toString() + "order by id desc limit 10"))

@jklingsporn
Copy link
Owner

What I mean is, if you need to remotely call a function that takes a Condition as an argument you have to convert it into a string before. So let's assume there is a wrapper around the dao that replaces the methods that take a Condition, like findOneByCondition(Condition) with findOneByCondition(String). The wrapper would do something like this

public Future<P> findOneByCondition(String condition){
  return dao.findOneByCondition(DSL.condition(condition));
}

@jklingsporn jklingsporn added this to the 5.2.0 milestone Jul 3, 2020
jklingsporn added a commit that referenced this issue Jul 3, 2020
@jklingsporn
Copy link
Owner

It was more work to add this annotation as expected. As described in jOOQ/jOOQ#10355 I had to cook a lot copy pasta to achieve this functionality. I will remove the duplicate code once it is implemented.

jklingsporn added a commit that referenced this issue Jul 27, 2020
# Conflicts:
#	vertx-jooq-generate/src/main/java/io/github/jklingsporn/vertx/jooq/generate/VertxGenerator.java
#	vertx-jooq-generate/src/test/java/generated/cf/reactive/guice/vertx/tables/pojos/Something.java
#	vertx-jooq-generate/src/test/java/generated/cf/reactive/regular/vertx/tables/pojos/Something.java
#	vertx-jooq-generate/src/test/java/generated/classic/reactive/guice/vertx/tables/pojos/Something.java
#	vertx-jooq-generate/src/test/java/generated/classic/reactive/regular/vertx/tables/pojos/Something.java
#	vertx-jooq-generate/src/test/java/generated/rx/reactive/guice/vertx/tables/pojos/Something.java
#	vertx-jooq-generate/src/test/java/generated/rx/reactive/regular/vertx/tables/pojos/Something.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants