I am new in maven and java. I am developing a maven project and I want to select some data with multiple rows from mysql DB. the following code has copied from below link. but it does not work. I have searched a lot and found some same results. but none of them works. I have no idea how can I do that.
JPA, Entity manager, select many columns and get result list custom objects
my code:
try{
EntityManagerFactory factory = Persistence.createEntityManagerFactory("com.mycompany_LinkedIn_war_1.0-SNAPSHOTPU");
EntityManager em = factory.createEntityManager();
TypedQuery<KarjooSearchInfo[]> q = em.createQuery(" SELECT name,education,gender,more,time FROM karjoo_search_info WHERE 1 ", KarjooSearchInfo[].class);
List<KarjooSearchInfo[]> resultList = q.getResultList();
do something...
}catch....
the exception is:
An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing [ SELECT name,education,gender,more,time FROM `karjoo_search_info` WHERE 1 ].
[69, 69] An identification variable must be provided for a range variable declaration.
[75, 76] The expression is not a valid conditional expression.