This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes How to encrypt a database entry when using javax.persistence package? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to encrypt a database entry when using javax.persistence package?" Watch "How to encrypt a database entry when using javax.persistence package?" New topic
Author

How to encrypt a database entry when using javax.persistence package?

deirdre lee
Greenhorn

Joined: Sep 03, 2008
Posts: 2
Hi,
I was wondering is there any way of encrypting a data entry that you persist to a database using the javax.persistence package.

For example the following SQL statement would be used to enter the data directly into the database using JDBC:



But using javax.persistence package, how is it possible to persist an object with an encrypted data element?

Extract from persistenceService:


Extract from myObject:



Luciano A. Pozzo
Ranch Hand

Joined: Jun 20, 2005
Posts: 112
Maybe you could use Entity Listeners:

  • @java.persistence.PrePersist
  • @java.persistence.PostPersist
  • @java.persistence.PostLoad
  • @java.persistence.PreUpdate
  • @java.persistence.PostUpdate
  • @java.persistence.PreRemove
  • @java.persistence.PostRemove

  •  
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: How to encrypt a database entry when using javax.persistence package?
     
    Similar Threads
    Can a class be mapped to a table and be Embeddable at the same time?
    Members are not poppulated?
    jsf navigation and database connection
    problem persisting an object with collections and manytomany relationship
    Sequence increment does not match its pre-allocation size.