Posting the Entity and the code that does the insert might help us with troubleshooting the issue.
Also, have you tried retrieving Entity1 using em.find(Entity1.class, id) to see if it can see the Entity1 instance?
To be able to decrypt the existing password, you can read the encrypted string from the database using JPA,
then decrypt it in the service layer.
The above solution will work although I have concerns about security.
The majority of applications/system consider it a security issue to send a customer's existing password by email.
What's stopping anyone from running this service to get customer's passwords?
Most would have a security question and answer filled up during registration.
When the customer forgets password, he supplies his username, security question/answer,
and a randomly generated password is emailed to him.
He will be forced to immediately change the password after he logins.
I don't think there's an encryption/decryption support in JPA.
You would have to do the encryption in the business/service layer as opposed to domain/data layer.
What we usually do is use an api (SAAJ, etc) to encrypt password when they are inserted.
When retrieving, the password supplied is encrypted and compared to the encrypted string in the database,
and the user is allowed to login.
This means there is really no need for decryption.
An error occurred while parsing the query filter 'SELECT o FROM LocState o where o.deleted = false and o.country.id = 88 AND UPPER(o.name) = "KARAMCHEDU"'.
Error message: org.apache.openjpa.kernel.jpql.TokenMgrError: Lexical error at line 1, column 93. Encountered: "\"" (34), after : ""
These two lines seem to suggest there's something wrong with the JPQL.
Shouldn't you be using single quotes instead of double quotes?
SELECT o FROM LocState o where o.deleted = false and o.country.id = 88 AND UPPER(o.name) = 'KARAMCHEDU'