This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package blog.thoughts.on.java.jpa21.converter; | |
import java.awt.Color; | |
import javax.persistence.AttributeConverter; | |
import javax.persistence.Converter; | |
@Converter | |
public class ColorConverter implements AttributeConverter<Color, String> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Stateless | |
@LocalBean | |
public class OrderManagement { | |
@PersistenceContext | |
private EntityManager em; | |
... | |
public void deleteOrder(Double amount) { | |
CriteriaBuilder cb = this.em.getCriteriaBuilder(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NamedQueries(@NamedQuery(name = "Trip.findByVehicle", query = "SELECT trip FROM Trip trip WHERE vehicle=:vehicle")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// define EJB client properties | |
final Properties props = new Properties(); | |
// define SSL encryption | |
props.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", | |
"true"); | |
props.put("remote.connection.default.connect.options.org.xnio.Options.SSL_STARTTLS", | |
"true"); | |
// connection properties | |
props.put("remote.connections", "default"); | |
props.put("remote.connection.default.host", "localhost"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@Table(name = "purchaseOrder") | |
@NamedEntityGraph(name = "graph.Order.items", | |
attributeNodes = @NamedAttributeNode(value = "items", subgraph = "items"), | |
subgraphs = @NamedSubgraph(name = "items", attributeNodes = @NamedAttributeNode("product"))) | |
public class Order implements Serializable { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
@Column(name = "id", updatable = false, nullable = false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@Table(name = "purchaseOrder") | |
@NamedEntityGraph(name = "graph.Order.items", | |
attributeNodes = @NamedAttributeNode(value = "items", subgraph = "items"), | |
subgraphs = @NamedSubgraph(name = "items", attributeNodes = @NamedAttributeNode("product"))) | |
public class Order implements Serializable { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
@Column(name = "id", updatable = false, nullable = false) |
OlderNewer