How do you get a list of entities in JQuery if entity field property has specific column name?

Lets say you have Orders entity:
@Entity
public class Orders {
//...

@NotEmpty
@Column(name="`User`")
private String username;
//...
@Entity
public class Orders {
//...

@NotEmpty
@Column(name="`User`")
private String username;
//...
And in Orders Data Access Object you get the list of orders for that specific user. How jQuery query should look? This way:
public interface OrderDAO extends JpaRepository<Orders, Integer> {

@Query("SELECT u from Orders WHERE u.User ?= 1")
public List<Orders> findOrderByUsername (String username);
}
public interface OrderDAO extends JpaRepository<Orders, Integer> {

@Query("SELECT u from Orders WHERE u.User ?= 1")
public List<Orders> findOrderByUsername (String username);
}
or like this:
public interface OrderDAO extends JpaRepository<Orders, Integer> {

@Query("SELECT u from Orders WHERE u.username ?= 1")
public List<Orders> findOrderByUsername (String username);
}
public interface OrderDAO extends JpaRepository<Orders, Integer> {

@Query("SELECT u from Orders WHERE u.username ?= 1")
public List<Orders> findOrderByUsername (String username);
}
? Does column name impact the way how you should access entity property inside jQuery?
3 Replies
JavaBot
JavaBot3y ago
Hey, @Tomasm21! Please remember to /close this post once your question has been answered!
Tomasm21
Tomasm21OP3y ago
I have found the way.
JavaBot
JavaBot3y ago
Post Closed
This post has been closed by <@312509109863710732>.
Want results from more Discord servers?
Add your server