You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The 3.5.0 release line throws a org.hibernate.query.SyntaxException when a @query tries to return a property of an object which itself is a different entity. A basic example of the entity relationships and repository method are shown below. This code attached works as expected under 3.4.5, where the country property of the entity is returned for use.
`` @entity
public class Country {
public Country(Integer id, String isoCode, String name) { this.id = id; this.iso3Code = isoCode; this.name = name; }
public Country() { }
@repository
public interface GroupCountryMappingRepository extends JpaRepository<GroupCountryMapping,String> { @query("SELECT country FROM GroupCountryMapping WHERE id=:grp")
Optional getCountryByGroupId(String grp);
}
``
If the query string is updated to SELECT gcm.country FROM GroupCountryMapping gcm WHERE gcm.id=:grp it appears that spring data/hibernate looks for a copy constructor rather than the typical no argument constructor.
The text was updated successfully, but these errors were encountered:
The 3.5.0 release line throws a org.hibernate.query.SyntaxException when a @query tries to return a property of an object which itself is a different entity. A basic example of the entity relationships and repository method are shown below. This code attached works as expected under 3.4.5, where the country property of the entity is returned for use.
``
@entity
public class Country {
public Country(Integer id, String isoCode, String name) { this.id = id; this.iso3Code = isoCode; this.name = name; }
public Country() { }
}
@entity
public class GroupCountryMapping {
public GroupCountryMapping(String id, String name, Country country) { this.id = id; this.name = name; this.country = country; }
public GroupCountryMapping() { }
}
@repository
public interface GroupCountryMappingRepository extends JpaRepository<GroupCountryMapping,String> {
@query("SELECT country FROM GroupCountryMapping WHERE id=:grp")
Optional getCountryByGroupId(String grp);
}
``
If the query string is updated to
SELECT gcm.country FROM GroupCountryMapping gcm WHERE gcm.id=:grp
it appears that spring data/hibernate looks for a copy constructor rather than the typical no argument constructor.The text was updated successfully, but these errors were encountered: