Posts

Showing posts with the label Jakarta Ee

Can Someone Explain MappedBy In JPA And Hibernate?

Answer : MappedBy signals hibernate that the key for the relationship is on the other side. This means that although you link 2 tables together, only 1 of those tables has a foreign key constraint to the other one. MappedBy allows you to still link from the table not containing the constraint to the other table. By specifying the @JoinColumn on both models you don't have a two way relationship. You have two one way relationships, and a very confusing mapping of it at that. You're telling both models that they "own" the IDAIRLINE column. Really only one of them actually should! The 'normal' thing is to take the @JoinColumn off of the @OneToMany side entirely, and instead add mappedBy to the @OneToMany . @OneToMany(cascade = CascadeType.ALL, mappedBy="airline") public Set<AirlineFlight> getAirlineFlights() { return airlineFlights; } That tells Hibernate "Go look over on the bean property named 'airline' on the th...

AspectJ Maven Plugin Cannot Compile My Project

Image
Answer : It seems like a known issue http://jira.codehaus.org/browse/MASPECTJ-125 You can fix it by adding the following to your pom file. <complianceLevel>1.6</complianceLevel> Update: While the things I said about AspectJ Maven configuration in this answer are all correct, the root cause of the concrete problem at hand - bad Maven dependency management - is described in my other answer. It would be better if that one was the accepted answer and not this one. User codelion's hint makes sense, please change your <compilationLevel> tag (typo?) - to <complianceLevel> . There is no need to downgrade to plugin version 1.6, you can keep 1.7. There is also no need to specify the configuration again within the <execution> section, the one at plugin level is enough. Please note that the default AspectJ version in plugin 1.7 is 1.8.2, so maybe your runtime dependency on 1.7.4 works, but if I were you I would upgrade that one too, optimally in...