It may not be hibernate, here's what I am doing:
JDBC connection to DB A to grab data
Code:
ResultSet rs = stmt.executeQuery("SELECT * FROM PRODUCTS WHERE ISBN='" + request.getParameter("gwAddIsbn") +"'");
This is then copied into another DB using hibernate:
Code:
Books book = new Books();
book.setIsbn(request.getParameter("gwAddIsbn"));
book.setAuthorId(Integer.decode(request.getParameter("authorId")));
book.setTitle(rs.getString("TITLE"));
book.setDescription(" ");
book.setDisplayLabel(" ");
book.setExtract(" ");
bookService.addBook(book);
If the TITLE field of the book contains entity references then the resulting field in the hibernate DB has the & of the entity ref encoded as &