@Query возвращающий объект вместо объекта [] Почему?JAVA

Программисты JAVA общаются здесь
Anonymous
@Query возвращающий объект вместо объекта [] Почему?

Сообщение Anonymous »

public interface ProductRepository extends JpaRepository {

@Query("select id, name, description, price, discount,
quantity, imagePublicKey, category, isVegetarian, expiryDate
from Product where id = :productId")
public Object[] findDetailedProduct(Integer productId);
}
< /code>
Этот метод возвращает только один объект вместо объекта [] Почему < /p>
@Override
public DetailedProductResponse getDetailedProduct(Integer productId) {
Object[] product = productRepository.findDetailedProduct(productId);
System.out.println(product.length);
System.out.println(product[0].getClass());
return ConversionUtility.convertToDetailedProduct(product);
}
< /code>
output:
1
class [ljava.lang.object; < /p>

Подробнее здесь: https://stackoverflow.com/questions/794 ... object-why

Вернуться в «JAVA»