aspose file tools*
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
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?