Different source generation #989

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

Comments

Projects
None yet
2 participants
@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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 6, 2014

Member

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?

Member

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

This comment has been minimized.

Show comment
Hide comment
@dyorgio

dyorgio 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 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

This comment has been minimized.

Show comment
Hide comment
@dyorgio

dyorgio 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
?

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 7, 2014

Member

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

Member

timowest commented Oct 7, 2014

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

@dyorgio

This comment has been minimized.

Show comment
Hide comment
@dyorgio

dyorgio 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 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

This comment has been minimized.

Show comment
Hide comment

dyorgio commented Oct 7, 2014

Done! #996

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 9, 2014

Member

Fixed via #996

Member

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