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
@SqlResultSetMapping( | |
name = "AuthorMapping", | |
entities = @EntityResult( | |
entityClass = Author.class, | |
fields = { | |
@FieldResult(name = "id", column = "authorId"), | |
@FieldResult(name = "firstName", column = "firstName"), | |
@FieldResult(name = "lastName", column = "lastName"), | |
@FieldResult(name = "version", column = "version")})) |
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 | |
public class Product implements Serializable | |
{ | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
@Column(name = "id", updatable = false, nullable = false) | |
private Long id = null; | |
@Version | |
@Column(name = "version") |
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 | |
@NamedEntityGraph(name = "graph.Order.items", | |
attributeNodes = @NamedAttributeNode("items")) | |
public class Order implements Serializable { | |
.... |
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
@Singleton | |
@Remote(SingletonRemote.class) | |
public class DefaultLock implements SingletonRemote { | |
Logger logger = Logger.getLogger(DefaultLock.class.getName()); | |
private int counter = 0; | |
@Override | |
public void method1() { | |
this.logger.info("method1: " + counter); |
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
@Converter | |
public class CryptoConverter implements AttributeConverter<String, String> { | |
private static final String ALGORITHM = "AES/ECB/PKCS5Padding"; | |
private static final byte[] KEY = "MySuperSecretKey".getBytes(); | |
@Override | |
public String convertToDatabaseColumn(String ccNumber) { | |
// do some encryption | |
Key key = new SecretKeySpec(KEY, "AES"); |
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 | |
public class CreditCard { | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
private Integer id; | |
private String ccNumber; | |
private String name; |
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) |
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"); |