Problem using @ElementCollection
mayankqait opened this issue · 3 comments
i have used sample code from this link https://github.com/Impetus/Kundera/wiki/Twitter-Example.
The code is working fine for cassandra but i am facing few issues with mysql.
1. Data is not persisted for @ElementCollection in table(means table is empty) for tweets. But when i am using
em.find(User.class, 1l) data is returned successfully.
2.Not able to run this simple query:
Query q = em.createQuery("Select e From User e where e.userId= :userId");
Error :-Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'USER_.tweet_id' in 'field list'.
But when i am running hibernated generated query in mysql console using mysql work bench data is returned successfully 👎
Select
USER_.USER_ID,
USER_.rel_status,
USER_.name,
USER_.personal_detail_id,
USER_.password,
USER_.tweet_id,
USER_.tweet_body,
USER_.tweeted_from,
USER_.PREFERENCE_ID
From
employeecombo.USER USER_
Where
USER_ID = 1;
This is my github link for reference:-
https://github.com/mayankqait/KunderaSample.git
Hi @mayankqait,
For storing in RDBMS, Kundera is using Hibernate.
Have you tried the same example with only hibernate? Is it working there?
Hi Devender,
I tried using only hibernate .It is working fine.
I am able to persist and retrive data.
Hi @mayankqait,
Can you please share hibernate sample code for this?
Please check create table script for tweeted
table with Kundera and with the only hibernate. Are they same?
-Dev