Hi,
Im using JPARepository and have the following native mysql query defined on my entity
Code:@Entity @DiscriminatorValue(value = User.NEW_USER_TYPE) @SqlResultSetMappings( @SqlResultSetMapping(name="countMapping", columns=[ @ColumnResult(name="count") ] ) ) @NamedNativeQueries([ @NamedNativeQuery(name="UserNew.countFacebookFriends",query="select count(*) as count from ql_user where type='NEW' and id in (select friend from ql_friends where user=:userId) and exists (select userId from ql_facebook_info where userId=id)",resultSetMapping="countMapping") ]) @Slf4j class UserNew extends User { ..
in my interface I seem to have no option but to return a BigIntger and cast it in the caller:
is there anyway I can have it mapped to an int (or long) in the forst place, just to keep things more concise ?Code:@Repository public interface UserNewDao extends JpaRepository<UserNew, Long> { /** * this maps to native query defined in entity * */ BigInteger countFacebookFriends(@Param("userId") Long userId) }
thanks


Reply With Quote
