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

Different source generation #989

Closed
dyorgio opened this issue Oct 6, 2014 · 7 comments
Closed

Different source generation #989

dyorgio opened this issue Oct 6, 2014 · 7 comments
Milestone

Comments

@dyorgio
Copy link

@dyorgio dyorgio commented Oct 6, 2014

Hi,

I´m trying to generate source from a compiled JAR.
When I generate classes from source using apt-maven-plugin everything is ok.

But, when I use querydsl-maven-plugin fields that using LocalDateTime are generate in a differente way.

Field:

@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATED_IN", precision = 6, updatable = false)
private LocalDateTime createdIn;

With apt-maven-plugin:

public final DateTimePath<org.threeten.bp.LocalDateTime> createdIn
                  = createDateTime("createdIn", org.threeten.bp.LocalDateTime.class);

With querydsl-maven-plugin:

public final ComparablePath<org.threeten.bp.LocalDateTime> createdIn
                  = createComparable("createdIn", org.threeten.bp.LocalDateTime.class);

The big problem is that I have some sources generated from source that extends theses classes generated from jar.

It´s causing some compilation errors:

required: com.mysema.query.types.path.DateTimePath<org.threeten.bp.LocalDateTime>
found: com.mysema.query.types.path.ComparablePath<org.threeten.bp.LocalDateTime>

@timowest
Copy link
Member

@timowest timowest commented Oct 6, 2014

querydsl-maven-plugin's jpa-export takes only the top level annotations into account, not @Temporal. In general it is advisable not to mix multiple code generation strategies.

Do you have multiple classes in your external jar that you need mirrored?

@dyorgio
Copy link
Author

@dyorgio dyorgio commented Oct 6, 2014

Hi, first of all, thank you for your response :).

Yes, we have a "base" project that will be used for many child projects (like a corporate apache-commons).

I want to not generate QueryDSL classes in this base, because not all child will use QueryDSL.

So, I'm generating in child project the QueryDSL sources from base project artifact.

So...why JPAAnnotationProcessor recognize @TeMPOraL and querydsl-maven-plugin#jpa-generator don't? :P

@dyorgio
Copy link
Author

@dyorgio dyorgio commented Oct 7, 2014

I found it on

querydsl / querydsl-apt / src / main / java / com / mysema / query / apt / jpa / JPAConfiguration.java
line: 135
method: inpect

But it is a code specific for APT (java.lang.model.Element parameter).
Any chance to put same logic on

querydsl / querydsl-maven-plugin / src / main / java / com / mysema / query / maven / JPAExporterMojo.jar
?

@timowest
Copy link
Member

@timowest timowest commented Oct 7, 2014

@dyorgio Yes, that could be done. Would you consider providing a pull request for it?

@dyorgio
Copy link
Author

@dyorgio dyorgio commented Oct 7, 2014

Working on...

What do you think about use a String key on TypeFactory?

I need to cache type not only by List< java.lang.reflect.Type >, but also Annotations and it parameters.

@dyorgio
Copy link
Author

@dyorgio dyorgio commented Oct 7, 2014

Done! #996

@timowest
Copy link
Member

@timowest timowest commented Oct 9, 2014

Fixed via #996

@timowest timowest closed this Oct 9, 2014
@timowest timowest added this to the 3.5.1 milestone Oct 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.