Open marinflorin opened 5 years ago
hey what is the @key annotation package is the org.simpleflatmapper.map.annotation.Key one? is it using lombok I assume? which version? looks like the number of dto matches but the value are not set
could you try just for testing purpose to manually add the constructors and getter on GroupDTO for example see if it's link to lombok, was there any error from the fieldMapperErrorHandler ? or rowHandlerErrorHandler?
Hey,
For @Key I am using import org.simpleflatmapper.map.annotation.Key;
Sorry, forgot to add the versions:
<!-- JOOQ -->
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>3.11.11</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
<version>3.11.11</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen</artifactId>
<version>3.11.11</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.simpleflatmapper/sfm -->
<dependency>
<groupId>org.simpleflatmapper</groupId>
<artifactId>sfm</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.simpleflatmapper</groupId>
<artifactId>sfm-jdbc</artifactId>
<version>6.6.2</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.simpleflatmapper</groupId>-->
<!-- <artifactId>sfm-jooq</artifactId>-->
<!-- <version>6.6.2</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jool</artifactId>
<version>0.9.14</version>
</dependency>
<!-- End JOOQ -->
Looks like the issue is raised by the constructors, even if I remove @NoArgsConstructor and @AllArgsConstructor and generate them from InteliJ the mapping dosent work, now I have removed the constructors and everything works as expected :)
Thank you, Florin
which version of java are you compiling with? it should work with the constructor, could you send me the .class of GroupDTO that did not work?
just did a test with lombok 1.16.12 and java8 and seems to be working fine
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.infotech.opensesame.src.user.user;
import org.simpleflatmapper.map.annotation.Key;
public class GroupDTO {
@Key
private Long id;
private String name;
public GroupDTO() {
}
public GroupDTO(Long id, String name) {
this.id = id;
this.name = name;
}
public Long getId() {
return this.id;
}
public String getName() {
return this.name;
}
public void setId(final Long id) {
this.id = id;
}
public void setName(final String name) {
this.name = name;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (!(o instanceof GroupDTO)) {
return false;
} else {
GroupDTO other = (GroupDTO)o;
if (!other.canEqual(this)) {
return false;
} else {
Object this$id = this.getId();
Object other$id = other.getId();
if (this$id == null) {
if (other$id != null) {
return false;
}
} else if (!this$id.equals(other$id)) {
return false;
}
Object this$name = this.getName();
Object other$name = other.getName();
if (this$name == null) {
if (other$name != null) {
return false;
}
} else if (!this$name.equals(other$name)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(final Object other) {
return other instanceof GroupDTO;
}
public int hashCode() {
int PRIME = true;
int result = 1;
Object $id = this.getId();
int result = result * 59 + ($id == null ? 43 : $id.hashCode());
Object $name = this.getName();
result = result * 59 + ($name == null ? 43 : $name.hashCode());
return result;
}
public String toString() {
return "GroupDTO(id=" + this.getId() + ", name=" + this.getName() + ")";
}
}
:: Spring Boot :: (v2.1.1.RELEASE)
florin@florin-UX430UAR:~$ java --version openjdk 11.0.2 2019-01-15 OpenJDK Runtime Environment (build 11.0.2+9-Ubuntu-3ubuntu118.04.3) OpenJDK 64-Bit Server VM (build 11.0.2+9-Ubuntu-3ubuntu118.04.3, mixed mode, sharing) lombok 1.18.4
BTW it looks like @AllArgsConstructor and @NoArgsConsturctor are working for UserDTO
are you using 1.18.6? could you send me the .class by email arnaud.roger at gmail.com
do you have any maven-compiler config?
Hey, I have a few plugins, that`s all
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/jooq</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<executions>
<execution>
<id>generate-jooq-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<jdbc>
<driver>${jdbc.driver}</driver>
<url>${jdbc.url}</url>
<user>${jdbc.user}</user>
<password>${jdbc.password}</password>
</jdbc>
<generator>
<generate>
<daos>true</daos>
<pojosEqualsAndHashCode>true</pojosEqualsAndHashCode>
<javaTimeTypes>true</javaTimeTypes>
</generate>
<database>
<name>org.jooq.meta.mysql.MySQLDatabase</name>
<includes>.*</includes>
<!--<excludes></excludes>-->
<inputSchema>${jdbc.database}</inputSchema>
</database>
<target>
<clean>true</clean>
<packageName>com.infotech.db</packageName>
<directory>target/generated-sources/jooq</directory>
</target>
</generator>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta-extensions</artifactId>
<version>3.11.9</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Hey,
First of all thank you for this great library :)
Right now I have an issue with empty inner object matching. Relationships: User 1:1 company User 1:1 profile User 1:m groups
Query Result:
DTOs UserDTO.java
ProfileDTO.java
CompanyDTO.java
GroupDTO.java
And the mapper:
The Code:
And the result:
UserDTO(id=19, firstName=Florin Catalin, lastName=Marin, email=florin1@hotmail.com, username=florin1, externalId=14616e7d-1e11-4972-b8d1-9567c4fe686a, chatId=null, chatTeamId=null, type=30, profile=ProfileDTO(id=null, phone=null, avatar=null, privacy=0), company=CompanyDTO(id=null, name=null, externalId=null, floor=0, phone=null, description=null), groups=[GroupDTO(id=null, name=null), GroupDTO(id=null, name=null)])
ProfileDTO(id=null, phone=null, avatar=null, privacy=0) CompanyDTO(id=null, name=null, externalId=null, floor=0, phone=null, description=null) GroupDTO(id=null, name=null) GroupDTO(id=null, name=null)
NOTE: This happens to all my data, here I have showed only 1 example NOTE: I have tried removing and adding @Key and addKeys without success
Thank you, Florin