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 = "employees") | |
| @NamedQueries({ | |
| @NamedQuery(name = "com.javaeeeee.dwstart.core.Employee.findAll", | |
| query = "select e from Employee e"), | |
| @NamedQuery(name = "com.javaeeeee.dwstart.core.Employee.findByName", | |
| query = "select e from Employee e " | |
| + "where e.firstName like :name " | |
| + "or e.lastName like :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
| -- A script to create employee table | |
| create table employees( | |
| -- auto-generated primary key | |
| id bigint primary key not null auto_increment, | |
| first_name varchar(255) not null, | |
| last_name varchar(255) not null, | |
| -- employee position | |
| e_position varchar(255) not null, | |
| phone varchar(255) not null, | |
| e_mail varchar(255) not null |
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
| public class DWGettingStartedConfiguration extends Configuration { | |
| ... | |
| /** | |
| * A factory used to connect to a relational database management system. | |
| * Factories are used by Dropwizard to group together related configuration | |
| * parameters such as database connection driver, URI, password etc. | |
| */ | |
| @NotNull |
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
| <dependency> | |
| <groupId>io.dropwizard</groupId> | |
| <artifactId>dropwizard-hibernate</artifactId> | |
| <version>${dropwizard.version}</version> | |
| </dependency> | |
| <dependency> | |
| <groupId>mysql</groupId> | |
| <artifactId>mysql-connector-java</artifactId> | |
| <version>5.1.36</version> | |
| </dependency> |
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
| # Database settings. | |
| database: | |
| # the name of the JDBC driver, mysql in our case | |
| driverClass: com.mysql.jdbc.Driver | |
| # the username | |
| user: javaeeeee | |
| # the password | |
| password: 1 | |
| # the JDBC URL; the database is called DWGettingStarted | |
| url: jdbc:mysql://localhost:3306/DWGettingStarted |
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
| ## YAML Template. | |
| --- | |
| password: p@ssw0rd | |
| #Server configuration. | |
| server: | |
| applicationConnectors: | |
| - type: http | |
| port: 8080 | |
| - type: https |
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
| { | |
| "_links":{ | |
| "self":{ | |
| "href":"/author/4554" | |
| }, | |
| "curries":[ | |
| { | |
| "name":"ns", | |
| "href":"http://booklistapi.com/rels/{rel}", | |
| "templated":true |
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
| { | |
| "_links":{ | |
| "self":{ | |
| "href":"/book/123" | |
| }, | |
| "curries":[ | |
| { | |
| "name":"ns", | |
| "href":"http://booklistapi.com/rels/{rel}", | |
| "templated":true |
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
| { | |
| "_links":{ | |
| "self":{ | |
| "href":"/book/123" | |
| }, | |
| "http://booklistapi.com/rels/authors":[ | |
| { | |
| "href":"/author/4554", | |
| "title":"Leonard Richardson" | |
| }, |
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
| { | |
| "_links":{ | |
| "self":{ | |
| "href":"/book/123" | |
| } | |
| }, | |
| "Title":"RESTful Web APIs", | |
| "Price":"$31.92", | |
| "Paperback":"408 pages", | |
| "Language":"English" |