Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Java Micronaut Data generates fake column

$
0
0

I have two Java Entites Obj and Trt for two tables in DB obj ( ID, ID_TRT,...) and trt(ID,...) defined as following:

@MappedEntity("obj")public class ObjEntity{...private TrtEntity trt;...@Nullable    @MappedProperty("ID_TRT")    @JoinColumn(name ="ID_TRT")    @Relation(value = Relation.Kind.MANY_TO_ONE)    public TraitementEntity getTrt() {        return trt;    }    public void setTrt(final TrtEntity trt) {        this.trt= trt;    }...}@MappedEntity("trt")public class TrtEntity{private Long id;private List<ObjEntity> objs;....@Relation(value = Relation.Kind.ONE_TO_MANY, mappedBy = "trt", cascade = { Relation.Cascade.ALL })    public List<ObjEntity> getObjs() {        return objs;    }...}

In a class, we call a method ObjRepository.findAll(...), which should execute the following SQL query:

select ID, ID_TRT, .... from obj where ...

Sometimes we get this query, but sometimes we have :

select ID, TRT_ID, .... from obj where ...

The problem is that ID_TRT becomes TRT_ID in generated query by Micronaut Data

Any idea?


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>