This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Your code works fine as you expected. It is a responsibility of the JPA to read the entity and persist the data to the database. Even though the "sec" object is managed in the persistence context, you can use it to refer the same relationship again and again.