├── Ch01
├── Ch01.sql
└── e-commerce
│ ├── e-commerce.iml
│ └── src
│ └── com
│ └── manning
│ └── javapersistence
│ └── ch01
│ ├── BillingDetails.java
│ └── User.java
├── Ch02
├── Ch02.sql
└── helloworld
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch02
│ │ │ ├── Message.java
│ │ │ └── repositories
│ │ │ └── MessageRepository.java
│ └── resources
│ │ └── META-INF
│ │ └── persistence.xml
│ └── test
│ ├── java
│ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch02
│ │ ├── HelloWorldHibernateTest.java
│ │ ├── HelloWorldHibernateToJPATest.java
│ │ ├── HelloWorldJPATest.java
│ │ ├── HelloWorldJPAToHibernateTest.java
│ │ ├── HelloWorldSpringDataJPATest.java
│ │ └── configuration
│ │ └── SpringDataConfiguration.java
│ └── resources
│ └── hibernate.cfg.xml
├── Ch03
├── Ch03.sql
├── domainmodel
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch03
│ │ ├── ex01
│ │ └── User.java
│ │ ├── ex02
│ │ └── User.java
│ │ ├── ex03
│ │ ├── Bid.java
│ │ └── Item.java
│ │ ├── ex04
│ │ ├── Bid.java
│ │ └── Item.java
│ │ └── ex05
│ │ └── package-info.java
├── metadataxmljpa
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch03
│ │ │ └── metadataxmljpa
│ │ │ ├── Item.java
│ │ │ └── repositories
│ │ │ └── ItemRepository.java
│ │ └── test
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch03
│ │ │ └── metadataxmljpa
│ │ │ ├── Helper.java
│ │ │ ├── PersistWithXmlMetadata.java
│ │ │ ├── PersistWithXmlMetadataSpringData.java
│ │ │ └── configuration
│ │ │ └── SpringDataConfiguration.java
│ │ └── resources
│ │ └── META-INF
│ │ ├── orm.xml
│ │ └── persistence.xml
├── metamodel
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch03
│ │ │ │ └── metamodel
│ │ │ │ └── Item.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch03
│ │ └── metamodel
│ │ └── MetamodelTest.java
└── validation
│ ├── pom.xml
│ └── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch03
│ │ └── validation
│ │ └── Item.java
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── ch03
│ └── validation
│ └── ModelValidation.java
├── Ch04
├── Ch04.sql
├── springdatajpa
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── springdatajpa
│ │ │ │ ├── SpringDataJpaApplication.java
│ │ │ │ ├── model
│ │ │ │ └── User.java
│ │ │ │ └── repositories
│ │ │ │ └── UserRepository.java
│ │ └── resources
│ │ │ └── application.properties
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── springdatajpa
│ │ └── SpringDataJpaApplicationTests.java
└── springdatajpa2
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── springdatajpa
│ │ │ ├── SpringDataJpaApplication.java
│ │ │ ├── model
│ │ │ ├── Projection.java
│ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── UserRepository.java
│ └── resources
│ │ └── application.properties
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── springdatajpa
│ ├── DeleteQueryTest.java
│ ├── FindUsersSortingAndPagingTest.java
│ ├── FindUsersUsingQueriesTest.java
│ ├── ModifyQueryTest.java
│ ├── ProjectionTest.java
│ ├── QueryByExampleTest.java
│ ├── QueryResultsTest.java
│ └── SpringDataJpaApplicationTests.java
├── Ch05
├── Ch05.sql
├── generator
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch05
│ │ │ │ ├── model
│ │ │ │ └── Item.java
│ │ │ │ ├── package-info.java
│ │ │ │ └── repositories
│ │ │ │ └── ItemRepository.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch05
│ │ ├── HelloWorldJPATest.java
│ │ ├── HelloWorldSpringDataJPATest.java
│ │ ├── Helper.java
│ │ └── configuration
│ │ └── SpringDataConfiguration.java
├── mapping
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch05
│ │ │ │ ├── CENamingStrategy.java
│ │ │ │ ├── model
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ │ │ ├── package-info.java
│ │ │ │ └── repositories
│ │ │ │ └── ItemRepository.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch05
│ │ ├── HelloWorldJPATest.java
│ │ ├── HelloWorldSpringDataJPATest.java
│ │ ├── Helper.java
│ │ └── configuration
│ │ └── SpringDataConfiguration.java
└── subselect
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch05
│ │ │ ├── model
│ │ │ ├── Bid.java
│ │ │ ├── Item.java
│ │ │ ├── ItemBidSummary.java
│ │ │ └── User.java
│ │ │ ├── package-info.java
│ │ │ └── repositories
│ │ │ ├── BidRepository.java
│ │ │ ├── ItemBidSummaryRepository.java
│ │ │ └── ItemRepository.java
│ └── resources
│ │ └── META-INF
│ │ └── persistence.xml
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── ch05
│ ├── Helper.java
│ ├── ItemBidSummarySpringDataTest.java
│ ├── ItemBidSummaryTest.java
│ └── configuration
│ └── SpringDataConfiguration.java
├── Ch06
├── Ch06.sql
├── mapping-value-types
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch06
│ │ │ │ ├── model
│ │ │ │ ├── Address.java
│ │ │ │ ├── AuctionType.java
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ │ │ └── repositories
│ │ │ │ ├── ItemRepository.java
│ │ │ │ └── UserRepository.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch06
│ │ │ ├── MappingValuesHibernateTest.java
│ │ │ ├── MappingValuesJPATest.java
│ │ │ ├── MappingValuesSpringDataJPATest.java
│ │ │ └── configuration
│ │ │ └── SpringDataConfiguration.java
│ │ └── resources
│ │ └── hibernate.cfg.xml
├── mapping-value-types2
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch06
│ │ │ │ ├── converter
│ │ │ │ └── MonetaryAmountConverter.java
│ │ │ │ ├── model
│ │ │ │ ├── Address.java
│ │ │ │ ├── AuctionType.java
│ │ │ │ ├── Bid.java
│ │ │ │ ├── City.java
│ │ │ │ ├── Item.java
│ │ │ │ ├── MonetaryAmount.java
│ │ │ │ └── User.java
│ │ │ │ └── repositories
│ │ │ │ ├── ItemRepository.java
│ │ │ │ └── UserRepository.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch06
│ │ │ ├── MappingValuesHibernateTest.java
│ │ │ ├── MappingValuesJPATest.java
│ │ │ ├── MappingValuesSpringDataJPATest.java
│ │ │ └── configuration
│ │ │ └── SpringDataConfiguration.java
│ │ └── resources
│ │ └── hibernate.cfg.xml
├── mapping-value-types3
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch06
│ │ │ │ ├── converter
│ │ │ │ ├── MonetaryAmountConverter.java
│ │ │ │ └── ZipcodeConverter.java
│ │ │ │ ├── model
│ │ │ │ ├── Address.java
│ │ │ │ ├── AuctionType.java
│ │ │ │ ├── Bid.java
│ │ │ │ ├── City.java
│ │ │ │ ├── GermanZipcode.java
│ │ │ │ ├── Item.java
│ │ │ │ ├── MonetaryAmount.java
│ │ │ │ ├── SwissZipcode.java
│ │ │ │ ├── User.java
│ │ │ │ └── Zipcode.java
│ │ │ │ └── repositories
│ │ │ │ ├── ItemRepository.java
│ │ │ │ └── UserRepository.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch06
│ │ │ ├── MappingValuesHibernateTest.java
│ │ │ ├── MappingValuesJPATest.java
│ │ │ ├── MappingValuesSpringDataJPATest.java
│ │ │ └── configuration
│ │ │ └── SpringDataConfiguration.java
│ │ └── resources
│ │ └── hibernate.cfg.xml
└── mapping-value-types4
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch06
│ │ │ ├── converter
│ │ │ ├── MonetaryAmountUserType.java
│ │ │ ├── ZipcodeConverter.java
│ │ │ └── package-info.java
│ │ │ ├── model
│ │ │ ├── Address.java
│ │ │ ├── AuctionType.java
│ │ │ ├── Bid.java
│ │ │ ├── City.java
│ │ │ ├── GermanZipcode.java
│ │ │ ├── Item.java
│ │ │ ├── MonetaryAmount.java
│ │ │ ├── SwissZipcode.java
│ │ │ ├── User.java
│ │ │ └── Zipcode.java
│ │ │ └── repositories
│ │ │ ├── ItemRepository.java
│ │ │ └── UserRepository.java
│ └── resources
│ │ └── META-INF
│ │ └── persistence.xml
│ └── test
│ ├── java
│ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch06
│ │ ├── MappingValuesHibernateTest.java
│ │ ├── MappingValuesJPATest.java
│ │ ├── MappingValuesSpringDataJPATest.java
│ │ └── configuration
│ │ └── SpringDataConfiguration.java
│ └── resources
│ ├── data.sql
│ └── hibernate.cfg.xml
├── Ch07
├── Ch07.sql
├── mapping-inheritance-embeddable
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch07
│ │ │ ├── model
│ │ │ ├── Dimensions.java
│ │ │ ├── Item.java
│ │ │ ├── Measurement.java
│ │ │ └── Weight.java
│ │ │ └── repositories
│ │ │ └── ItemRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch07
│ │ ├── MappingInheritanceSpringDataJPATest.java
│ │ └── configuration
│ │ └── SpringDataConfiguration.java
├── mapping-inheritance-joined
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch07
│ │ │ ├── model
│ │ │ ├── BankAccount.java
│ │ │ ├── BillingDetails.java
│ │ │ └── CreditCard.java
│ │ │ └── repositories
│ │ │ ├── BankAccountRepository.java
│ │ │ ├── BillingDetailsRepository.java
│ │ │ └── CreditCardRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch07
│ │ ├── MappingInheritanceSpringDataJPATest.java
│ │ └── configuration
│ │ └── SpringDataConfiguration.java
├── mapping-inheritance-manytoone
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch07
│ │ │ ├── model
│ │ │ ├── BankAccount.java
│ │ │ ├── BillingDetails.java
│ │ │ ├── CreditCard.java
│ │ │ └── User.java
│ │ │ └── repositories
│ │ │ ├── BankAccountRepository.java
│ │ │ ├── BillingDetailsRepository.java
│ │ │ ├── CreditCardRepository.java
│ │ │ └── UserRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch07
│ │ ├── MappingInheritanceSpringDataJPATest.java
│ │ └── configuration
│ │ └── SpringDataConfiguration.java
├── mapping-inheritance-mappedsuperclass
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch07
│ │ │ │ ├── model
│ │ │ │ ├── BankAccount.java
│ │ │ │ ├── BillingDetails.java
│ │ │ │ └── CreditCard.java
│ │ │ │ └── repositories
│ │ │ │ ├── BankAccountRepository.java
│ │ │ │ ├── BillingDetailsRepository.java
│ │ │ │ └── CreditCardRepository.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch07
│ │ │ ├── MappingInheritanceHibernateTest.java
│ │ │ ├── MappingInheritanceJPATest.java
│ │ │ ├── MappingInheritanceSpringDataJPATest.java
│ │ │ └── configuration
│ │ │ └── SpringDataConfiguration.java
│ │ └── resources
│ │ └── hibernate.cfg.xml
├── mapping-inheritance-mixed
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch07
│ │ │ ├── model
│ │ │ ├── BankAccount.java
│ │ │ ├── BillingDetails.java
│ │ │ └── CreditCard.java
│ │ │ └── repositories
│ │ │ ├── BankAccountRepository.java
│ │ │ ├── BillingDetailsRepository.java
│ │ │ └── CreditCardRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch07
│ │ ├── MappingInheritanceSpringDataJPATest.java
│ │ └── configuration
│ │ └── SpringDataConfiguration.java
├── mapping-inheritance-onetomany
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch07
│ │ │ ├── model
│ │ │ ├── BankAccount.java
│ │ │ ├── BillingDetails.java
│ │ │ ├── CreditCard.java
│ │ │ └── User.java
│ │ │ └── repositories
│ │ │ ├── BankAccountRepository.java
│ │ │ ├── BillingDetailsRepository.java
│ │ │ ├── CreditCardRepository.java
│ │ │ └── UserRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch07
│ │ ├── MappingInheritanceSpringDataJPATest.java
│ │ └── configuration
│ │ └── SpringDataConfiguration.java
├── mapping-inheritance-singletable
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch07
│ │ │ │ ├── model
│ │ │ │ ├── BankAccount.java
│ │ │ │ ├── BillingDetails.java
│ │ │ │ └── CreditCard.java
│ │ │ │ └── repositories
│ │ │ │ ├── BankAccountRepository.java
│ │ │ │ ├── BillingDetailsRepository.java
│ │ │ │ └── CreditCardRepository.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch07
│ │ │ ├── MappingInheritanceHibernateTest.java
│ │ │ ├── MappingInheritanceJPATest.java
│ │ │ ├── MappingInheritanceSpringDataJPATest.java
│ │ │ └── configuration
│ │ │ └── SpringDataConfiguration.java
│ │ └── resources
│ │ └── hibernate.cfg.xml
├── mapping-inheritance-singletableformula
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch07
│ │ │ │ ├── model
│ │ │ │ ├── BankAccount.java
│ │ │ │ ├── BillingDetails.java
│ │ │ │ └── CreditCard.java
│ │ │ │ └── repositories
│ │ │ │ ├── BankAccountRepository.java
│ │ │ │ ├── BillingDetailsRepository.java
│ │ │ │ └── CreditCardRepository.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch07
│ │ │ ├── MappingInheritanceHibernateTest.java
│ │ │ ├── MappingInheritanceJPATest.java
│ │ │ ├── MappingInheritanceSpringDataJPATest.java
│ │ │ └── configuration
│ │ │ └── SpringDataConfiguration.java
│ │ └── resources
│ │ └── hibernate.cfg.xml
└── mapping-inheritance-tableperclass
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch07
│ │ │ ├── model
│ │ │ ├── BankAccount.java
│ │ │ ├── BillingDetails.java
│ │ │ └── CreditCard.java
│ │ │ └── repositories
│ │ │ ├── BankAccountRepository.java
│ │ │ ├── BillingDetailsRepository.java
│ │ │ └── CreditCardRepository.java
│ └── resources
│ │ └── META-INF
│ │ └── persistence.xml
│ └── test
│ ├── java
│ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch07
│ │ ├── MappingInheritanceHibernateTest.java
│ │ ├── MappingInheritanceJPATest.java
│ │ ├── MappingInheritanceSpringDataJPATest.java
│ │ └── configuration
│ │ └── SpringDataConfiguration.java
│ └── resources
│ └── hibernate.cfg.xml
├── Ch08
├── Ch08.sql
├── mapping-associations
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch08
│ │ │ ├── Constants.java
│ │ │ ├── onetomany
│ │ │ ├── bidirectional
│ │ │ │ ├── Bid.java
│ │ │ │ └── Item.java
│ │ │ ├── cascadepersist
│ │ │ │ ├── Bid.java
│ │ │ │ └── Item.java
│ │ │ ├── cascaderemove
│ │ │ │ ├── Bid.java
│ │ │ │ └── Item.java
│ │ │ ├── ondeletecascade
│ │ │ │ ├── Bid.java
│ │ │ │ └── Item.java
│ │ │ └── orphanremoval
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── onetomany
│ │ │ ├── bidirectional
│ │ │ ├── BidRepository.java
│ │ │ └── ItemRepository.java
│ │ │ ├── cascadepersist
│ │ │ ├── BidRepository.java
│ │ │ └── ItemRepository.java
│ │ │ ├── cascaderemove
│ │ │ ├── BidRepository.java
│ │ │ └── ItemRepository.java
│ │ │ ├── ondeletecascade
│ │ │ ├── BidRepository.java
│ │ │ └── ItemRepository.java
│ │ │ └── orphanremoval
│ │ │ ├── BidRepository.java
│ │ │ ├── ItemRepository.java
│ │ │ └── UserRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch08
│ │ ├── configuration
│ │ └── onetomany
│ │ │ ├── bidirectional
│ │ │ └── SpringDataConfiguration.java
│ │ │ ├── cascadepersist
│ │ │ └── SpringDataConfiguration.java
│ │ │ ├── cascaderemove
│ │ │ └── SpringDataConfiguration.java
│ │ │ ├── ondeletecascade
│ │ │ └── SpringDataConfiguration.java
│ │ │ └── orphanremoval
│ │ │ └── SpringDataConfiguration.java
│ │ └── onetomany
│ │ ├── bidirectional
│ │ └── MappingAssociationsSpringDataJPATest.java
│ │ ├── cascadepersist
│ │ └── MappingAssociationsSpringDataJPATest.java
│ │ ├── cascaderemove
│ │ └── MappingAssociationsSpringDataJPATest.java
│ │ ├── ondeletecascade
│ │ └── MappingAssociationsSpringDataJPATest.java
│ │ └── orphanremoval
│ │ └── MappingAssociationsSpringDataJPATest.java
└── mapping-collections
│ ├── pom.xml
│ └── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch08
│ │ ├── Constants.java
│ │ ├── bagofembeddables
│ │ ├── Image.java
│ │ └── Item.java
│ │ ├── bagofstrings
│ │ └── Item.java
│ │ ├── bagofstringsorderby
│ │ └── Item.java
│ │ ├── embeddablesetofstrings
│ │ ├── Address.java
│ │ └── User.java
│ │ ├── listofstrings
│ │ └── Item.java
│ │ ├── mapofembeddables
│ │ ├── Filename.java
│ │ ├── Image.java
│ │ └── Item.java
│ │ ├── mapofstrings
│ │ └── Item.java
│ │ ├── mapofstringsembeddables
│ │ ├── Image.java
│ │ └── Item.java
│ │ ├── mapofstringsorderby
│ │ └── Item.java
│ │ ├── repositories
│ │ ├── bagofembeddables
│ │ │ └── ItemRepository.java
│ │ ├── bagofstrings
│ │ │ └── ItemRepository.java
│ │ ├── bagofstringsorderby
│ │ │ └── ItemRepository.java
│ │ ├── embeddablesetofstrings
│ │ │ └── UserRepository.java
│ │ ├── listofstrings
│ │ │ └── ItemRepository.java
│ │ ├── mapofembeddables
│ │ │ └── ItemRepository.java
│ │ ├── mapofstrings
│ │ │ └── ItemRepository.java
│ │ ├── mapofstringsembeddables
│ │ │ └── ItemRepository.java
│ │ ├── mapofstringsorderby
│ │ │ └── ItemRepository.java
│ │ ├── setofembeddables
│ │ │ └── ItemRepository.java
│ │ ├── setofembeddablesorderby
│ │ │ └── ItemRepository.java
│ │ ├── setofstrings
│ │ │ └── ItemRepository.java
│ │ ├── setofstringsorderby
│ │ │ └── ItemRepository.java
│ │ ├── sortedmapofstrings
│ │ │ └── ItemRepository.java
│ │ └── sortedsetofstrings
│ │ │ └── ItemRepository.java
│ │ ├── setofembeddables
│ │ ├── Image.java
│ │ └── Item.java
│ │ ├── setofembeddablesorderby
│ │ ├── Image.java
│ │ └── Item.java
│ │ ├── setofstrings
│ │ └── Item.java
│ │ ├── setofstringsorderby
│ │ └── Item.java
│ │ ├── sortedmapofstrings
│ │ └── Item.java
│ │ └── sortedsetofstrings
│ │ └── Item.java
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── ch08
│ ├── bagofembeddables
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── bagofstrings
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── bagofstringsorderby
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── configuration
│ ├── bagofembeddables
│ │ └── SpringDataConfiguration.java
│ ├── bagofstrings
│ │ └── SpringDataConfiguration.java
│ ├── bagofstringsorderby
│ │ └── SpringDataConfiguration.java
│ ├── embeddablesetofstrings
│ │ └── SpringDataConfiguration.java
│ ├── listofstrings
│ │ └── SpringDataConfiguration.java
│ ├── mapofembeddables
│ │ └── SpringDataConfiguration.java
│ ├── mapofstrings
│ │ └── SpringDataConfiguration.java
│ ├── mapofstringsembeddables
│ │ └── SpringDataConfiguration.java
│ ├── mapofstringsorderby
│ │ └── SpringDataConfiguration.java
│ ├── setofembeddables
│ │ └── SpringDataConfiguration.java
│ ├── setofembeddablesorderby
│ │ └── SpringDataConfiguration.java
│ ├── setofstrings
│ │ └── SpringDataConfiguration.java
│ ├── setofstringsorderby
│ │ └── SpringDataConfiguration.java
│ ├── sortedmapofstrings
│ │ └── SpringDataConfiguration.java
│ └── sortedsetofstrings
│ │ └── SpringDataConfiguration.java
│ ├── embeddablesetofstrings
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── listofstrings
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── mapofembeddables
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── mapofstrings
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── mapofstringsembeddables
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── mapofstringsorderby
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── setofembeddables
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── setofembeddablesorderby
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── setofstrings
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── setofstringsorderby
│ └── MappingCollectionsSpringDataJPATest.java
│ ├── sortedmapofstrings
│ └── MappingCollectionsSpringDataJPATest.java
│ └── sortedsetofstrings
│ └── MappingCollectionsSpringDataJPATest.java
├── Ch09
├── Ch09.sql
├── manytomany-bidirectional
│ ├── manytomany-bidirectional.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── manytomany
│ │ │ └── bidirectional
│ │ │ │ ├── Category.java
│ │ │ │ └── Item.java
│ │ │ └── repositories
│ │ │ └── manytomany
│ │ │ └── bidirectional
│ │ │ ├── CategoryRepository.java
│ │ │ └── ItemRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── manytomany
│ │ │ └── bidirectional
│ │ │ └── SpringDataConfiguration.java
│ │ └── manytomany
│ │ └── bidirectional
│ │ ├── AdvancedMappingSpringDataJPATest.java
│ │ └── TestService.java
├── manytomany-linkentity
│ ├── manytomany-linkentity.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── manytomany
│ │ │ └── linkedentity
│ │ │ │ ├── CategorizedItem.java
│ │ │ │ ├── Category.java
│ │ │ │ └── Item.java
│ │ │ └── repositories
│ │ │ └── manytomany
│ │ │ └── linkedentity
│ │ │ ├── CategorizedItemRepository.java
│ │ │ ├── CategoryRepository.java
│ │ │ └── ItemRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── manytomany
│ │ │ └── linkedentity
│ │ │ └── SpringDataConfiguration.java
│ │ └── manytomany
│ │ └── linkedentity
│ │ ├── AdvancedMappingSpringDataJPATest.java
│ │ └── TestService.java
├── manytomany-ternary
│ ├── manytomany-ternary.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── manytomany
│ │ │ └── ternary
│ │ │ │ ├── CategorizedItem.java
│ │ │ │ ├── Category.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── manytomany
│ │ │ └── ternary
│ │ │ ├── CategoryRepository.java
│ │ │ ├── ItemRepository.java
│ │ │ └── UserRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── manytomany
│ │ │ └── ternary
│ │ │ └── SpringDataConfiguration.java
│ │ └── manytomany
│ │ └── ternary
│ │ ├── AdvancedMappingSpringDataJPATest.java
│ │ └── TestService.java
├── maps-mapkey
│ ├── maps-mapkey.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── maps
│ │ │ └── mapkey
│ │ │ │ ├── Bid.java
│ │ │ │ └── Item.java
│ │ │ └── repositories
│ │ │ └── maps
│ │ │ └── mapkey
│ │ │ ├── BidRepository.java
│ │ │ └── ItemRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── maps
│ │ │ └── mapkey
│ │ │ └── SpringDataConfiguration.java
│ │ └── maps
│ │ └── mapkey
│ │ ├── AdvancedMappingSpringDataJPATest.java
│ │ └── TestService.java
├── maps-ternary
│ ├── maps-ternary.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── maps
│ │ │ └── ternary
│ │ │ │ ├── Category.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── maps
│ │ │ └── ternary
│ │ │ ├── CategoryRepository.java
│ │ │ ├── ItemRepository.java
│ │ │ └── UserRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── maps
│ │ │ └── ternary
│ │ │ └── SpringDataConfiguration.java
│ │ └── maps
│ │ └── ternary
│ │ ├── AdvancedMappingSpringDataJPATest.java
│ │ └── TestService.java
├── onetomany-bag
│ ├── onetomany-bag.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── onetomany
│ │ │ └── bag
│ │ │ │ ├── Bid.java
│ │ │ │ └── Item.java
│ │ │ └── repositories
│ │ │ └── onetomany
│ │ │ └── bag
│ │ │ ├── BidRepository.java
│ │ │ └── ItemRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── onetomany
│ │ │ └── bag
│ │ │ └── SpringDataConfiguration.java
│ │ └── onetomany
│ │ └── bag
│ │ └── AdvancedMappingSpringDataJPATest.java
├── onetomany-embeddable-jointable
│ ├── onetomany-embeddable-jointable.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── onetomany
│ │ │ └── embeddablejointable
│ │ │ │ ├── Address.java
│ │ │ │ ├── Shipment.java
│ │ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── onetomany
│ │ │ └── embeddablejointable
│ │ │ ├── ShipmentRepository.java
│ │ │ └── UserRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── onetomany
│ │ │ └── embeddablejointable
│ │ │ └── SpringDataConfiguration.java
│ │ └── onetomany
│ │ └── embeddablejointable
│ │ ├── AdvancedMappingSpringDataJPATest.java
│ │ └── TestService.java
├── onetomany-embeddable
│ ├── onetomany-embeddable.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── onetomany
│ │ │ └── embeddable
│ │ │ │ ├── Address.java
│ │ │ │ ├── Shipment.java
│ │ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── onetomany
│ │ │ └── embeddable
│ │ │ ├── ShipmentRepository.java
│ │ │ └── UserRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── onetomany
│ │ │ └── embeddable
│ │ │ └── SpringDataConfiguration.java
│ │ └── onetomany
│ │ └── embeddable
│ │ ├── AdvancedMappingSpringDataJPATest.java
│ │ └── TestService.java
├── onetomany-jointable
│ ├── onetomany-jointable.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── onetomany
│ │ │ └── jointable
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── onetomany
│ │ │ └── jointable
│ │ │ ├── ItemRepository.java
│ │ │ └── UserRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── onetomany
│ │ │ └── jointable
│ │ │ └── SpringDataConfiguration.java
│ │ └── onetomany
│ │ └── jointable
│ │ ├── AdvancedMappingSpringDataJPATest.java
│ │ └── TestService.java
├── onetomany-list
│ ├── onetomany-list.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── onetomany
│ │ │ └── list
│ │ │ │ ├── Bid.java
│ │ │ │ └── Item.java
│ │ │ └── repositories
│ │ │ └── onetomany
│ │ │ └── list
│ │ │ ├── BidRepository.java
│ │ │ └── ItemRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── onetomany
│ │ │ └── list
│ │ │ └── SpringDataConfiguration.java
│ │ └── onetomany
│ │ └── list
│ │ ├── AdvancedMappingSpringDataJPATest.java
│ │ └── TestService.java
├── onetoone-foreigngenerator
│ ├── onetoone-foreigngenerator.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── onetoone
│ │ │ └── foreigngenerator
│ │ │ │ ├── Address.java
│ │ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── onetoone
│ │ │ └── foreigngenerator
│ │ │ ├── AddressRepository.java
│ │ │ └── UserRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── onetoone
│ │ │ └── foreigngenerator
│ │ │ └── SpringDataConfiguration.java
│ │ └── onetoone
│ │ └── foreigngenerator
│ │ └── AdvancedMappingSpringDataJPATest.java
├── onetoone-foreignkey
│ ├── onetoone-foreignkey.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── onetoone
│ │ │ └── foreignkey
│ │ │ │ ├── Address.java
│ │ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── onetoone
│ │ │ └── foreignkey
│ │ │ ├── AddressRepository.java
│ │ │ └── UserRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── onetoone
│ │ │ └── foreignkey
│ │ │ └── SpringDataConfiguration.java
│ │ └── onetoone
│ │ └── foreignkey
│ │ └── AdvancedMappingSpringDataJPATest.java
├── onetoone-jointable
│ ├── onetoone-jointable.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch09
│ │ │ ├── Constants.java
│ │ │ ├── onetoone
│ │ │ └── jointable
│ │ │ │ ├── Item.java
│ │ │ │ ├── Shipment.java
│ │ │ │ └── ShipmentState.java
│ │ │ └── repositories
│ │ │ └── onetoone
│ │ │ └── jointable
│ │ │ ├── ItemRepository.java
│ │ │ └── ShipmentRepository.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── configuration
│ │ └── onetoone
│ │ │ └── jointable
│ │ │ └── SpringDataConfiguration.java
│ │ └── onetoone
│ │ └── jointable
│ │ └── AdvancedMappingSpringDataJPATest.java
└── onetoone-sharedprimarykey
│ ├── onetoone-sharedprimarykey.iml
│ ├── pom.xml
│ └── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch09
│ │ ├── Constants.java
│ │ ├── onetoone
│ │ └── sharedprimarykey
│ │ │ ├── Address.java
│ │ │ └── User.java
│ │ └── repositories
│ │ └── onetoone
│ │ └── sharedprimarykey
│ │ ├── AddressRepository.java
│ │ └── UserRepository.java
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── ch09
│ ├── configuration
│ └── onetoone
│ │ └── sharedprimarykey
│ │ └── SpringDataConfiguration.java
│ └── onetoone
│ └── sharedprimarykey
│ ├── AdvancedMappingSpringDataJPATest.java
│ └── TestService.java
├── Ch10
├── Ch10.sql
├── managing-data
│ ├── managing-data.iml
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch10
│ │ │ │ ├── Address.java
│ │ │ │ ├── Constants.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch10
│ │ └── SimpleTransitionsTest.java
└── managing-data2
│ ├── managing-data2.iml
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch10
│ │ │ ├── Bid.java
│ │ │ ├── Constants.java
│ │ │ ├── Item.java
│ │ │ └── User.java
│ └── resources
│ │ └── META-INF
│ │ └── persistence.xml
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── ch10
│ ├── FetchTestData.java
│ ├── ReadOnly.java
│ └── TestData.java
├── Ch11
├── Ch11.sql
├── transactions
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch11
│ │ │ │ ├── Constants.java
│ │ │ │ └── concurrency
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Category.java
│ │ │ │ ├── InvalidBidException.java
│ │ │ │ └── Item.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch11
│ │ └── concurrency
│ │ ├── ConcurrencyTestData.java
│ │ ├── Locking.java
│ │ ├── TestData.java
│ │ └── Versioning.java
├── transactions2
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch11
│ │ │ │ ├── Constants.java
│ │ │ │ └── timestamp
│ │ │ │ └── Item.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch11
│ │ └── timestamp
│ │ └── VersioningTimestamp.java
├── transactions3
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch11
│ │ │ │ ├── Constants.java
│ │ │ │ └── versionall
│ │ │ │ └── Item.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch11
│ │ └── versionall
│ │ └── VersioningAll.java
├── transactions4
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch11
│ │ │ │ ├── Constants.java
│ │ │ │ └── concurrency
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Category.java
│ │ │ │ ├── InvalidBidException.java
│ │ │ │ └── Item.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch11
│ │ └── concurrency
│ │ └── NonTransactional.java
└── transactions5-springdata
│ ├── pom.xml
│ └── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch11
│ │ ├── concurrency
│ │ ├── Item.java
│ │ └── Log.java
│ │ ├── exceptions
│ │ └── DuplicateItemNameException.java
│ │ └── repositories
│ │ ├── ItemRepository.java
│ │ ├── ItemRepositoryCustom.java
│ │ ├── ItemRepositoryImpl.java
│ │ ├── LogRepository.java
│ │ ├── LogRepositoryCustom.java
│ │ └── LogRepositoryImpl.java
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── ch11
│ ├── concurrency
│ └── TransactionPropagationTest.java
│ └── configuration
│ └── SpringDataConfiguration.java
├── Ch12
├── Ch12.sql
├── batch
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch12
│ │ │ │ ├── Constants.java
│ │ │ │ └── batch
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch12
│ │ └── batch
│ │ ├── Batch.java
│ │ ├── FetchTestData.java
│ │ └── TestData.java
├── cartesianproduct
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch12
│ │ │ │ ├── Constants.java
│ │ │ │ └── cartesianproduct
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch12
│ │ └── cartesianproduct
│ │ ├── CartesianProduct.java
│ │ ├── FetchTestData.java
│ │ └── TestData.java
├── eagerjoin
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch12
│ │ │ │ ├── Constants.java
│ │ │ │ └── eagerjoin
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch12
│ │ └── eagerjoin
│ │ ├── EagerJoin.java
│ │ ├── FetchTestData.java
│ │ └── TestData.java
├── eagerselect
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch12
│ │ │ │ ├── Constants.java
│ │ │ │ └── eagerselect
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch12
│ │ └── eagerselect
│ │ ├── EagerQueryBids.java
│ │ ├── EagerQueryUsers.java
│ │ ├── EagerSelect.java
│ │ ├── FetchTestData.java
│ │ └── TestData.java
├── fetchloadgraph
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch12
│ │ │ │ ├── Constants.java
│ │ │ │ └── fetchloadgraph
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch12
│ │ └── fetchloadgraph
│ │ ├── FetchLoadGraph.java
│ │ ├── FetchTestData.java
│ │ └── TestData.java
├── nplusoneselects
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch12
│ │ │ │ ├── Constants.java
│ │ │ │ └── nplusoneselects
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch12
│ │ └── nplusoneselects
│ │ ├── FetchTestData.java
│ │ ├── NPlusOneSelects.java
│ │ └── TestData.java
├── profile
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch12
│ │ │ │ ├── Constants.java
│ │ │ │ └── profile
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Item.java
│ │ │ │ ├── User.java
│ │ │ │ └── package-info.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch12
│ │ └── profile
│ │ ├── FetchTestData.java
│ │ ├── Profile.java
│ │ └── TestData.java
├── proxy
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch12
│ │ │ │ ├── Constants.java
│ │ │ │ └── proxy
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Category.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch12
│ │ └── proxy
│ │ ├── FetchTestData.java
│ │ ├── LazyProxyCollections.java
│ │ └── TestData.java
└── subselect
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch12
│ │ │ ├── Constants.java
│ │ │ └── subselect
│ │ │ ├── Bid.java
│ │ │ ├── Item.java
│ │ │ └── User.java
│ └── resources
│ │ └── META-INF
│ │ └── persistence.xml
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── ch12
│ └── subselect
│ ├── FetchTestData.java
│ ├── Subselect.java
│ └── TestData.java
├── Ch13
├── Ch13.sql
├── callback
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch13
│ │ │ │ ├── Constants.java
│ │ │ │ └── filtering
│ │ │ │ └── callback
│ │ │ │ ├── CurrentUser.java
│ │ │ │ ├── Item.java
│ │ │ │ ├── Log.java
│ │ │ │ ├── PersistEntityListener.java
│ │ │ │ └── User.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch13
│ │ └── filtering
│ │ └── Callback.java
├── cascade
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch13
│ │ │ │ ├── Constants.java
│ │ │ │ └── filtering
│ │ │ │ └── cascade
│ │ │ │ ├── BankAccount.java
│ │ │ │ ├── Bid.java
│ │ │ │ ├── BillingDetails.java
│ │ │ │ ├── CreditCard.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch13
│ │ └── filtering
│ │ └── Cascade.java
├── dynamic
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch13
│ │ │ │ ├── Constants.java
│ │ │ │ └── filtering
│ │ │ │ └── dynamic
│ │ │ │ ├── Category.java
│ │ │ │ ├── Item.java
│ │ │ │ ├── User.java
│ │ │ │ └── package-info.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch13
│ │ └── filtering
│ │ ├── DynamicFilter.java
│ │ └── TestData.java
├── envers
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch13
│ │ │ │ ├── Constants.java
│ │ │ │ └── filtering
│ │ │ │ └── envers
│ │ │ │ ├── Bid.java
│ │ │ │ ├── Item.java
│ │ │ │ └── User.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── persistence.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch13
│ │ └── filtering
│ │ └── Envers.java
└── interceptor
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch13
│ │ │ ├── Constants.java
│ │ │ └── filtering
│ │ │ └── interceptor
│ │ │ ├── AuditLogRecord.java
│ │ │ ├── Auditable.java
│ │ │ ├── Item.java
│ │ │ └── User.java
│ └── resources
│ │ └── META-INF
│ │ └── persistence.xml
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── ch13
│ └── filtering
│ ├── AuditLogInterceptor.java
│ ├── AuditLogging.java
│ └── SecurityLoadListener.java
├── Ch14
├── Ch14.sql
├── spring-hibernate-dao-gen
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch14
│ │ │ ├── Bid.java
│ │ │ ├── Item.java
│ │ │ └── dao
│ │ │ ├── AbstractGenericDao.java
│ │ │ ├── BidDaoImpl.java
│ │ │ ├── GenericDao.java
│ │ │ └── ItemDaoImpl.java
│ │ └── test
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch14
│ │ │ ├── DatabaseService.java
│ │ │ ├── SpringHibernateTest.java
│ │ │ └── configuration
│ │ │ └── SpringConfiguration.java
│ │ └── resources
│ │ └── application-context.xml
├── spring-hibernate-dao
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch14
│ │ │ ├── Bid.java
│ │ │ ├── Item.java
│ │ │ └── dao
│ │ │ ├── BidDao.java
│ │ │ ├── BidDaoImpl.java
│ │ │ ├── ItemDao.java
│ │ │ └── ItemDaoImpl.java
│ │ └── test
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch14
│ │ │ ├── DatabaseService.java
│ │ │ ├── SpringHibernateTest.java
│ │ │ └── configuration
│ │ │ └── SpringConfiguration.java
│ │ └── resources
│ │ └── application-context.xml
├── spring-jpa-dao-gen
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch14
│ │ │ ├── Bid.java
│ │ │ ├── Item.java
│ │ │ └── dao
│ │ │ ├── AbstractGenericDao.java
│ │ │ ├── BidDaoImpl.java
│ │ │ ├── GenericDao.java
│ │ │ └── ItemDaoImpl.java
│ │ └── test
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch14
│ │ │ ├── DatabaseService.java
│ │ │ ├── SpringJpaTest.java
│ │ │ └── configuration
│ │ │ └── SpringConfiguration.java
│ │ └── resources
│ │ ├── META-INF
│ │ └── persistence.xml
│ │ └── application-context.xml
└── spring-jpa-dao
│ ├── pom.xml
│ └── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch14
│ │ ├── Bid.java
│ │ ├── Item.java
│ │ └── dao
│ │ ├── BidDao.java
│ │ ├── BidDaoImpl.java
│ │ ├── ItemDao.java
│ │ └── ItemDaoImpl.java
│ └── test
│ ├── java
│ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch14
│ │ ├── DatabaseService.java
│ │ ├── SpringJpaTest.java
│ │ └── configuration
│ │ └── SpringConfiguration.java
│ └── resources
│ ├── META-INF
│ └── persistence.xml
│ └── application-context.xml
├── Ch15
├── Ch15.sql
├── spring-data-jdbc
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch15
│ │ │ │ ├── SpringDataJdbcApplication.java
│ │ │ │ ├── model
│ │ │ │ └── User.java
│ │ │ │ └── repositories
│ │ │ │ └── UserRepository.java
│ │ └── resources
│ │ │ ├── application.properties
│ │ │ └── schema.sql
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch15
│ │ ├── FindUsersUsingQueriesTest.java
│ │ └── SpringDataJdbcApplicationTests.java
├── spring-data-jdbc2
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch15
│ │ │ │ ├── SpringDataJdbcApplication.java
│ │ │ │ ├── model
│ │ │ │ └── User.java
│ │ │ │ └── repositories
│ │ │ │ └── UserRepository.java
│ │ └── resources
│ │ │ ├── META-INF
│ │ │ └── jdbc-named-queries.properties
│ │ │ ├── application.properties
│ │ │ └── schema.sql
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch15
│ │ ├── DeleteQueryTest.java
│ │ ├── FindUsersSortingAndPagingTest.java
│ │ ├── FindUsersUsingQueriesTest.java
│ │ ├── ModifyQueryTest.java
│ │ ├── QueryResultsTest.java
│ │ └── SpringDataJdbcApplicationTests.java
├── spring-data-jdbc3
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch15
│ │ │ │ ├── SpringDataJdbcApplication.java
│ │ │ │ ├── model
│ │ │ │ ├── Address.java
│ │ │ │ └── User.java
│ │ │ │ └── repositories
│ │ │ │ ├── AddressOneToOneRepository.java
│ │ │ │ └── UserOneToOneRepository.java
│ │ └── resources
│ │ │ ├── application.properties
│ │ │ └── schema.sql
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch15
│ │ └── UserAddressOneToOneTest.java
├── spring-data-jdbc4
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch15
│ │ │ │ ├── SpringDataJdbcApplication.java
│ │ │ │ ├── model
│ │ │ │ ├── Address.java
│ │ │ │ └── User.java
│ │ │ │ └── repositories
│ │ │ │ └── UserAddressEmbeddedRepository.java
│ │ └── resources
│ │ │ ├── application.properties
│ │ │ └── schema.sql
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch15
│ │ └── UserAddressEmbeddedTest.java
├── spring-data-jdbc5
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── ch15
│ │ │ │ ├── SpringDataJdbcApplication.java
│ │ │ │ ├── model
│ │ │ │ ├── Address.java
│ │ │ │ └── User.java
│ │ │ │ └── repositories
│ │ │ │ ├── AddressOneToManyRepository.java
│ │ │ │ └── UserOneToManyRepository.java
│ │ └── resources
│ │ │ ├── application.properties
│ │ │ └── schema.sql
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch15
│ │ └── UserAddressOneToManyTest.java
└── spring-data-jdbc6
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch15
│ │ │ ├── SpringDataJdbcApplication.java
│ │ │ ├── model
│ │ │ ├── Address.java
│ │ │ ├── User.java
│ │ │ └── UserAddress.java
│ │ │ └── repositories
│ │ │ ├── AddressManyToManyRepository.java
│ │ │ ├── UserAddressManyToManyRepository.java
│ │ │ └── UserManyToManyRepository.java
│ └── resources
│ │ ├── application.properties
│ │ └── schema.sql
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── ch15
│ └── UserAddressManyToManyTest.java
├── Ch16
├── Ch16.sql
├── spring-data-rest-events
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch16
│ │ │ ├── Application.java
│ │ │ ├── beans
│ │ │ └── CsvDataLoader.java
│ │ │ ├── events
│ │ │ ├── RepositoryEventListener.java
│ │ │ └── UserRepositoryEventHandler.java
│ │ │ ├── model
│ │ │ ├── Auction.java
│ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── UserRepository.java
│ │ └── resources
│ │ ├── application.properties
│ │ ├── log4j.properties
│ │ ├── rest
│ │ └── commands.rest
│ │ └── users_information.csv
├── spring-data-rest-projections
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── ch16
│ │ │ ├── Application.java
│ │ │ ├── beans
│ │ │ └── CsvDataLoader.java
│ │ │ ├── events
│ │ │ ├── RepositoryEventListener.java
│ │ │ └── UserRepositoryEventHandler.java
│ │ │ ├── model
│ │ │ ├── Address.java
│ │ │ ├── Auction.java
│ │ │ ├── User.java
│ │ │ └── UserProjection.java
│ │ │ └── repositories
│ │ │ └── UserRepository.java
│ │ └── resources
│ │ ├── application.properties
│ │ ├── log4j.properties
│ │ ├── rest
│ │ └── commands.rest
│ │ └── users_information.csv
└── spring-data-rest
│ ├── pom.xml
│ └── src
│ └── main
│ ├── java
│ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── ch16
│ │ ├── Application.java
│ │ ├── beans
│ │ └── CsvDataLoader.java
│ │ ├── model
│ │ ├── Auction.java
│ │ └── User.java
│ │ └── repositories
│ │ └── UserRepository.java
│ └── resources
│ ├── application.properties
│ ├── rest
│ └── commands.rest
│ └── users_information.csv
├── Ch17
├── springdatamongodb
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── springdatamongodb
│ │ │ │ ├── SpringDataMongoDBApplication.java
│ │ │ │ ├── model
│ │ │ │ └── User.java
│ │ │ │ └── repositories
│ │ │ │ └── UserRepository.java
│ │ └── resources
│ │ │ └── application.properties
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── springdatamongodb
│ │ ├── FindUsersSortingAndPagingTest.java
│ │ ├── FindUsersTest.java
│ │ ├── PersistenceConstructorTest.java
│ │ ├── QueryByExampleTest.java
│ │ ├── QueryByMatcherTest.java
│ │ ├── QueryResultsTest.java
│ │ ├── SpringDataMongoDBApplicationTests.java
│ │ └── TransientTest.java
├── springdatamongodb2
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manning
│ │ │ │ └── javapersistence
│ │ │ │ └── springdatamongodb
│ │ │ │ ├── SpringDataMongoDBApplication.java
│ │ │ │ ├── model
│ │ │ │ ├── Address.java
│ │ │ │ └── User.java
│ │ │ │ └── repositories
│ │ │ │ ├── AddressRepository.java
│ │ │ │ └── UserRepository.java
│ │ └── resources
│ │ │ └── application.properties
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── springdatamongodb
│ │ ├── FindUsersSortingAndPagingTest.java
│ │ ├── FindUsersTest.java
│ │ ├── PersistenceConstructorTest.java
│ │ ├── QueryByExampleTest.java
│ │ ├── QueryByMatcherTest.java
│ │ ├── QueryResultsTest.java
│ │ ├── SpringDataMongoDBApplicationTests.java
│ │ └── TransientTest.java
└── springdatamongodb3
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── springdatamongodb
│ │ │ ├── SpringDataMongoDBApplication.java
│ │ │ ├── configuration
│ │ │ └── MongoDBConfig.java
│ │ │ ├── model
│ │ │ ├── Address.java
│ │ │ └── User.java
│ │ │ └── repositories
│ │ │ ├── AddressRepository.java
│ │ │ └── UserRepository.java
│ └── resources
│ │ └── application.properties
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── springdatamongodb
│ ├── GenerateUsers.java
│ ├── repository
│ ├── FindUsersSortingAndPagingTest.java
│ ├── FindUsersTest.java
│ ├── PersistenceConstructorTest.java
│ ├── QueryByExampleTest.java
│ ├── QueryByMatcherTest.java
│ ├── QueryResultsTest.java
│ ├── SpringDataMongoDBApplicationTests.java
│ └── TransientTest.java
│ └── template
│ ├── FindAndModifyTest.java
│ ├── FindUsersSortingAndPagingTest.java
│ ├── FindUsersTest.java
│ ├── PersistenceConstructorTest.java
│ ├── SaveUpdateTest.java
│ ├── SpringDataMongoDBApplicationTests.java
│ ├── StreamableTest.java
│ ├── TransientTest.java
│ ├── UpdateFirstTest.java
│ ├── UpdateMultiTest.java
│ └── UpsertTest.java
├── Ch18
└── hibernate-ogm
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── hibernateogm
│ │ │ └── model
│ │ │ ├── Address.java
│ │ │ ├── Bid.java
│ │ │ ├── Item.java
│ │ │ └── User.java
│ └── resources
│ │ └── META-INF
│ │ └── persistence.xml
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── hibernateogm
│ └── HibernateOGMTest.java
├── Ch19
├── Ch19.sql
└── querydsl
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ ├── Constants.java
│ │ │ └── querydsl
│ │ │ ├── model
│ │ │ ├── Address.java
│ │ │ ├── Bid.java
│ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── UserRepository.java
│ └── resources
│ │ └── META-INF
│ │ └── persistence.xml
│ └── test
│ └── java
│ └── com
│ └── manning
│ └── javapersistence
│ └── querydsl
│ ├── GenerateUsers.java
│ ├── QuerydslTest.java
│ └── configuration
│ └── SpringDataConfiguration.java
└── Ch20
├── 1 spring testing
├── HELP.md
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── testing
│ │ │ ├── Application.java
│ │ │ ├── model
│ │ │ ├── Log.java
│ │ │ └── User.java
│ │ │ ├── repositories
│ │ │ ├── LogRepository.java
│ │ │ └── UserRepository.java
│ │ │ └── service
│ │ │ └── UserService.java
│ └── resources
│ │ └── application.properties
│ └── test
│ ├── java
│ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── testing
│ │ ├── ExecutionTimeTest.java
│ │ ├── SaveRetrieveUserTest.java
│ │ ├── TransactionalTest.java
│ │ ├── TransactionsManagementTest.java
│ │ └── UsersHelper.java
│ └── resources
│ └── config.properties
├── 2 spring profiles
├── HELP.md
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── testing
│ │ │ ├── Application.java
│ │ │ ├── model
│ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── UserRepository.java
│ └── resources
│ │ ├── application-dev.properties
│ │ ├── application-prod.properties
│ │ └── application.properties
│ └── test
│ ├── java
│ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── testing
│ │ ├── SpringProfilesTest.java
│ │ └── UsersHelper.java
│ └── resources
│ └── config.properties
├── 3 spring listeners
├── HELP.md
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── manning
│ │ │ └── javapersistence
│ │ │ └── testing
│ │ │ ├── Application.java
│ │ │ ├── model
│ │ │ └── User.java
│ │ │ └── repositories
│ │ │ └── UserRepository.java
│ └── resources
│ │ ├── application-dev.properties
│ │ ├── application-prod.properties
│ │ └── application.properties
│ └── test
│ ├── java
│ └── com
│ │ └── manning
│ │ └── javapersistence
│ │ └── testing
│ │ ├── ListenersTest.java
│ │ ├── UsersHelper.java
│ │ └── listeners
│ │ └── DatabaseOperationsListener.java
│ └── resources
│ └── config.properties
└── Ch20.sql
/Ch01/Ch01.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE USERS (
2 | USERNAME VARCHAR(15) NOT NULL PRIMARY KEY,
3 | ADDRESS VARCHAR(255) NOT NULL
4 | );
5 |
6 | CREATE TABLE BILLINGDETAILS (
7 | ACCOUNT VARCHAR(15) NOT NULL PRIMARY KEY,
8 | BANKNAME VARCHAR(255) NOT NULL,
9 | USERNAME VARCHAR(15) NOT NULL,
10 | FOREIGN KEY (USERNAME) REFERENCES USERS(USERNAME)
11 | );
12 |
13 | CREATE TABLE USERS (
14 | ID BIGINT NOT NULL PRIMARY KEY,
15 | USERNAME VARCHAR(15) NOT NULL UNIQUE,
16 | ADDRESS_STREET VARCHAR(255) NOT NULL,
17 | ADDRESS_ZIPCODE VARCHAR(5) NOT NULL,
18 | ADDRESS_CITY VARCHAR(255) NOT NULL
19 | );
20 |
21 | CREATE TABLE BILLINGDETAILS (
22 | ID BIGINT NOT NULL PRIMARY KEY,
23 | ACCOUNT VARCHAR(15) NOT NULL,
24 | BANKNAME VARCHAR(255) NOT NULL,
25 | USER_ID BIGINT NOT NULL,
26 | FOREIGN KEY (USER_ID) REFERENCES USERS(ID)
27 | );
28 |
29 | CREATE TABLE USER_BILLINGDETAILS (
30 | USER_ID BIGINT,
31 | BILLINGDETAILS_ID BIGINT,
32 | PRIMARY KEY (USER_ID, BILLINGDETAILS_ID),
33 | FOREIGN KEY (USER_ID) REFERENCES USERS(ID),
34 | FOREIGN KEY (BILLINGDETAILS_ID) REFERENCES BILLINGDETAILS(ID)
35 | );
36 |
--------------------------------------------------------------------------------
/Ch01/e-commerce/e-commerce.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Ch02/Ch02.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH02;
2 | CREATE DATABASE CH02;
--------------------------------------------------------------------------------
/Ch02/helloworld/src/main/java/com/manning/javapersistence/ch02/repositories/MessageRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch02.repositories;
22 |
23 | import com.manning.javapersistence.ch02.Message;
24 | import org.springframework.data.repository.CrudRepository;
25 |
26 | public interface MessageRepository extends CrudRepository {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Ch02/helloworld/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch02/helloworld/src/test/resources/hibernate.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 | com.mysql.cj.jdbc.Driver
8 |
9 |
10 | jdbc:mysql://localhost:3306/CH02?serverTimezone=UTC
11 |
12 | root
13 |
14 | 50
15 | true
16 | create
17 |
18 |
--------------------------------------------------------------------------------
/Ch03/Ch03.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH03_METADATAXMLJPA;
2 | DROP DATABASE IF EXISTS CH03_METAMODEL;
3 | CREATE DATABASE CH03_METADATAXMLJPA;
4 | CREATE DATABASE CH03_METAMODEL;
--------------------------------------------------------------------------------
/Ch03/domainmodel/pom.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 | com.manning.javapersistence
6 | domainmodel
7 | jar
8 | 1.0-SNAPSHOT
9 | domainmodel
10 | http://maven.apache.org
11 |
12 |
13 |
14 |
15 | maven-compiler-plugin
16 | 3.10.1
17 |
18 | 17
19 | 17
20 |
21 |
22 |
23 | maven-surefire-plugin
24 | 2.22.2
25 |
26 |
27 |
28 |
29 |
30 |
31 | org.hibernate
32 | hibernate-entitymanager
33 | 5.6.9.Final
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Ch03/domainmodel/src/main/java/com/manning/javapersistence/ch03/ex01/User.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch03.ex01;
22 |
23 | public class User {
24 |
25 | private String username;
26 |
27 | public String getUsername() {
28 | return username;
29 | }
30 |
31 | public void setUsername(String username) {
32 | this.username = username;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/Ch03/domainmodel/src/main/java/com/manning/javapersistence/ch03/ex03/Bid.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch03.ex03;
22 |
23 | public class Bid {
24 |
25 | private Item item;
26 |
27 | public Item getItem() {
28 | return item;
29 | }
30 |
31 | void setItem(Item item) {
32 | this.item = item;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/Ch03/metadataxmljpa/src/test/java/com/manning/javapersistence/ch03/metadataxmljpa/Helper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch03.metadataxmljpa;
22 |
23 | import java.util.Date;
24 |
25 | public class Helper {
26 |
27 | static Date tomorrow() {
28 | return new Date(new Date().getTime() + (1000 * 60 * 60 * 24));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Ch03/metadataxmljpa/src/test/resources/META-INF/orm.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | TIMESTAMP
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Ch03/metamodel/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch04/Ch04.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH04_SPRINGDATAJPA;
2 | CREATE DATABASE CH04_SPRINGDATAJPA;
3 |
--------------------------------------------------------------------------------
/Ch04/springdatajpa/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.2/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.2/maven-plugin/reference/html/#build-image)
9 | * [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#boot-features-jpa-and-spring-data)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
15 | * [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)
16 |
17 |
--------------------------------------------------------------------------------
/Ch04/springdatajpa/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://localhost:3306/CH04_SPRINGDATAJPA?serverTimezone=UTC
2 | spring.datasource.username=root
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
5 | spring.jpa.show-sql=true
6 | spring.jpa.hibernate.ddl-auto=create
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Ch04/springdatajpa2/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.2/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.2/maven-plugin/reference/html/#build-image)
9 | * [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#boot-features-jpa-and-spring-data)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
15 | * [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)
16 |
17 |
--------------------------------------------------------------------------------
/Ch04/springdatajpa2/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://localhost:3306/CH04_SPRINGDATAJPA?serverTimezone=UTC
2 | spring.datasource.username=root
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
5 | spring.jpa.show-sql=true
6 | spring.jpa.hibernate.ddl-auto=create
7 |
8 |
--------------------------------------------------------------------------------
/Ch05/Ch05.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH05_GENERATOR;
2 | DROP DATABASE IF EXISTS CH05_MAPPING;
3 | DROP DATABASE IF EXISTS CH05_SUBSELECT;
4 | CREATE DATABASE CH05_GENERATOR;
5 | CREATE DATABASE CH05_MAPPING;
6 | CREATE DATABASE CH05_SUBSELECT;
--------------------------------------------------------------------------------
/Ch05/generator/src/main/java/com/manning/javapersistence/ch05/package-info.java:
--------------------------------------------------------------------------------
1 | @org.hibernate.annotations.GenericGenerator(
2 | name = "ID_GENERATOR",
3 | strategy = "enhanced-sequence",
4 | parameters = {
5 | @org.hibernate.annotations.Parameter(
6 | name = "sequence_name",
7 | value = "JPWHSD_SEQUENCE"
8 | ),
9 | @org.hibernate.annotations.Parameter(
10 | name = "initial_value",
11 | value = "1000"
12 | )
13 | })
14 | package com.manning.javapersistence.ch05;
15 |
--------------------------------------------------------------------------------
/Ch05/generator/src/main/java/com/manning/javapersistence/ch05/repositories/ItemRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch05.repositories;
22 |
23 | import com.manning.javapersistence.ch05.model.Item;
24 | import org.springframework.data.repository.CrudRepository;
25 |
26 | public interface ItemRepository extends CrudRepository- {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Ch05/generator/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch05/generator/src/test/java/com/manning/javapersistence/ch05/Helper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch05;
22 |
23 | import java.util.Date;
24 |
25 | public class Helper {
26 |
27 | static Date tomorrow() {
28 | return new Date(new Date().getTime() + (1000 * 60 * 60 * 24));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Ch05/mapping/src/main/java/com/manning/javapersistence/ch05/package-info.java:
--------------------------------------------------------------------------------
1 | @org.hibernate.annotations.GenericGenerator(
2 | name = "ID_GENERATOR",
3 | strategy = "enhanced-sequence",
4 | parameters = {
5 | @org.hibernate.annotations.Parameter(
6 | name = "sequence_name",
7 | value = "JPWHSD_SEQUENCE"
8 | ),
9 | @org.hibernate.annotations.Parameter(
10 | name = "initial_value",
11 | value = "1000"
12 | )
13 | })
14 | package com.manning.javapersistence.ch05;
15 |
--------------------------------------------------------------------------------
/Ch05/mapping/src/main/java/com/manning/javapersistence/ch05/repositories/ItemRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch05.repositories;
22 |
23 | import com.manning.javapersistence.ch05.model.Item;
24 | import org.springframework.data.repository.CrudRepository;
25 |
26 | public interface ItemRepository extends CrudRepository
- {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Ch05/mapping/src/test/java/com/manning/javapersistence/ch05/Helper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch05;
22 |
23 | import java.util.Date;
24 |
25 | public class Helper {
26 |
27 | static Date tomorrow() {
28 | return new Date(new Date().getTime() + (1000 * 60 * 60 * 24));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Ch05/subselect/src/main/java/com/manning/javapersistence/ch05/package-info.java:
--------------------------------------------------------------------------------
1 | @org.hibernate.annotations.GenericGenerator(
2 | name = "ID_GENERATOR",
3 | strategy = "enhanced-sequence",
4 | parameters = {
5 | @org.hibernate.annotations.Parameter(
6 | name = "sequence_name",
7 | value = "JPWHSD_SEQUENCE"
8 | ),
9 | @org.hibernate.annotations.Parameter(
10 | name = "initial_value",
11 | value = "1000"
12 | )
13 | })
14 | package com.manning.javapersistence.ch05;
15 |
--------------------------------------------------------------------------------
/Ch05/subselect/src/main/java/com/manning/javapersistence/ch05/repositories/BidRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch05.repositories;
22 |
23 | import com.manning.javapersistence.ch05.model.Bid;
24 | import org.springframework.data.repository.CrudRepository;
25 |
26 | public interface BidRepository extends CrudRepository {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Ch05/subselect/src/main/java/com/manning/javapersistence/ch05/repositories/ItemRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch05.repositories;
22 |
23 | import com.manning.javapersistence.ch05.model.Item;
24 | import org.springframework.data.repository.CrudRepository;
25 |
26 | public interface ItemRepository extends CrudRepository
- {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Ch05/subselect/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch05/subselect/src/test/java/com/manning/javapersistence/ch05/Helper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch05;
22 |
23 | import java.util.Date;
24 |
25 | public class Helper {
26 |
27 | static Date tomorrow() {
28 | return new Date(new Date().getTime() + (1000 * 60 * 60 * 24));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Ch06/Ch06.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH06_MAPPING_VALUE_TYPES;
2 | CREATE DATABASE CH06_MAPPING_VALUE_TYPES;
3 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types/src/main/java/com/manning/javapersistence/ch06/model/AuctionType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch06.model;
22 |
23 | public enum AuctionType {
24 | HIGHEST_BID,
25 | LOWEST_BID,
26 | FIXED_PRICE
27 | }
28 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types/src/main/java/com/manning/javapersistence/ch06/repositories/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch06.repositories;
22 |
23 | import com.manning.javapersistence.ch06.model.User;
24 | import org.springframework.data.repository.CrudRepository;
25 |
26 | public interface UserRepository extends CrudRepository {
27 | }
28 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types/src/test/resources/hibernate.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 | com.mysql.cj.jdbc.Driver
8 |
9 |
10 | jdbc:mysql://localhost:3306/CH06_MAPPING_VALUE_TYPES?serverTimezone=UTC
11 |
12 | root
13 |
14 | 50
15 | true
16 | create
17 |
18 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types2/src/main/java/com/manning/javapersistence/ch06/model/AuctionType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch06.model;
22 |
23 | public enum AuctionType {
24 | HIGHEST_BID,
25 | LOWEST_BID,
26 | FIXED_PRICE
27 | }
28 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types2/src/main/java/com/manning/javapersistence/ch06/repositories/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch06.repositories;
22 |
23 | import com.manning.javapersistence.ch06.model.User;
24 | import org.springframework.data.repository.CrudRepository;
25 |
26 | public interface UserRepository extends CrudRepository {
27 | }
28 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types2/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types2/src/test/resources/hibernate.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 | com.mysql.cj.jdbc.Driver
8 |
9 |
10 | jdbc:mysql://localhost:3306/CH06_MAPPING_VALUE_TYPES?serverTimezone=UTC
11 |
12 | root
13 |
14 | 50
15 | true
16 | create
17 |
18 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types3/src/main/java/com/manning/javapersistence/ch06/model/AuctionType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch06.model;
22 |
23 | public enum AuctionType {
24 | HIGHEST_BID,
25 | LOWEST_BID,
26 | FIXED_PRICE
27 | }
28 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types3/src/main/java/com/manning/javapersistence/ch06/model/GermanZipcode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch06.model;
22 |
23 | public class GermanZipcode extends Zipcode {
24 |
25 | public GermanZipcode(String value) {
26 | super(value);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types3/src/main/java/com/manning/javapersistence/ch06/model/SwissZipcode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch06.model;
22 |
23 | public class SwissZipcode extends Zipcode {
24 |
25 | public SwissZipcode(String value) {
26 | super(value);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types3/src/main/java/com/manning/javapersistence/ch06/repositories/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch06.repositories;
22 |
23 | import com.manning.javapersistence.ch06.model.User;
24 | import org.springframework.data.repository.CrudRepository;
25 |
26 | public interface UserRepository extends CrudRepository {
27 | }
28 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types3/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types3/src/test/resources/hibernate.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 | com.mysql.cj.jdbc.Driver
8 |
9 |
10 | jdbc:mysql://localhost:3306/CH06_MAPPING_VALUE_TYPES?serverTimezone=UTC
11 |
12 | root
13 |
14 | 50
15 | true
16 | create
17 |
18 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types4/src/main/java/com/manning/javapersistence/ch06/converter/ZipcodeConverter.java:
--------------------------------------------------------------------------------
1 | package com.manning.javapersistence.ch06.converter;
2 |
3 | import com.manning.javapersistence.ch06.model.GermanZipcode;
4 | import com.manning.javapersistence.ch06.model.SwissZipcode;
5 | import com.manning.javapersistence.ch06.model.Zipcode;
6 |
7 | import javax.persistence.AttributeConverter;
8 | import javax.persistence.Converter;
9 |
10 | @Converter
11 | public class ZipcodeConverter
12 | implements AttributeConverter {
13 |
14 | @Override
15 | public String convertToDatabaseColumn(Zipcode attribute) {
16 | return attribute.getValue();
17 | }
18 |
19 | @Override
20 | public Zipcode convertToEntityAttribute(String s) {
21 | if (s.length() == 5)
22 | return new GermanZipcode(s);
23 | else if (s.length() == 4)
24 | return new SwissZipcode(s);
25 | throw new IllegalArgumentException(
26 | "Unsupported zipcode in database: " + s
27 | );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types4/src/main/java/com/manning/javapersistence/ch06/converter/package-info.java:
--------------------------------------------------------------------------------
1 | @org.hibernate.annotations.TypeDefs({
2 | @org.hibernate.annotations.TypeDef(
3 | name = "monetary_amount_usd",
4 | typeClass = MonetaryAmountUserType.class,
5 | parameters = {@Parameter(name = "convertTo", value = "USD")}
6 | ),
7 | @org.hibernate.annotations.TypeDef(
8 | name = "monetary_amount_eur",
9 | typeClass = MonetaryAmountUserType.class,
10 | parameters = {@Parameter(name = "convertTo", value = "EUR")}
11 | )
12 | })
13 | package com.manning.javapersistence.ch06.converter;
14 |
15 | import org.hibernate.annotations.Parameter;
--------------------------------------------------------------------------------
/Ch06/mapping-value-types4/src/main/java/com/manning/javapersistence/ch06/model/AuctionType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch06.model;
22 |
23 | public enum AuctionType {
24 | HIGHEST_BID,
25 | LOWEST_BID,
26 | FIXED_PRICE
27 | }
28 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types4/src/main/java/com/manning/javapersistence/ch06/model/GermanZipcode.java:
--------------------------------------------------------------------------------
1 | package com.manning.javapersistence.ch06.model;
2 |
3 | public class GermanZipcode extends Zipcode {
4 |
5 | public GermanZipcode(String value) {
6 | super(value);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types4/src/main/java/com/manning/javapersistence/ch06/model/SwissZipcode.java:
--------------------------------------------------------------------------------
1 | package com.manning.javapersistence.ch06.model;
2 |
3 | public class SwissZipcode extends Zipcode {
4 |
5 | public SwissZipcode(String value) {
6 | super(value);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types4/src/main/java/com/manning/javapersistence/ch06/model/Zipcode.java:
--------------------------------------------------------------------------------
1 | package com.manning.javapersistence.ch06.model;
2 |
3 | import java.util.Objects;
4 |
5 | public abstract class Zipcode {
6 |
7 | private String value;
8 |
9 | public Zipcode(String value) {
10 | this.value = value;
11 | }
12 |
13 | public String getValue() {
14 | return value;
15 | }
16 |
17 | @Override
18 | public boolean equals(Object o) {
19 | if (this == o) return true;
20 | if (o == null || getClass() != o.getClass()) return false;
21 | Zipcode zipcode = (Zipcode) o;
22 | return Objects.equals(value, zipcode.value);
23 | }
24 |
25 | @Override
26 | public int hashCode() {
27 | return Objects.hash(value);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types4/src/main/java/com/manning/javapersistence/ch06/repositories/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch06.repositories;
22 |
23 | import com.manning.javapersistence.ch06.model.User;
24 | import org.springframework.data.repository.CrudRepository;
25 |
26 | public interface UserRepository extends CrudRepository {
27 | }
28 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types4/src/test/resources/data.sql:
--------------------------------------------------------------------------------
1 | INSERT INTO ITEM (id, item_name, START_PRICE, description, verified, IMPERIALWEIGHT) VALUES (1, 'Some Item', 1, 'descriptiondescription', '1', 1000);
2 |
--------------------------------------------------------------------------------
/Ch06/mapping-value-types4/src/test/resources/hibernate.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 | com.mysql.cj.jdbc.Driver
8 |
9 |
10 | jdbc:mysql://localhost:3306/CH06_MAPPING_VALUE_TYPES?serverTimezone=UTC
11 |
12 | root
13 |
14 | 50
15 | true
16 | create
17 |
18 |
--------------------------------------------------------------------------------
/Ch07/Ch07.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH07_MAPPING_INHERITANCE;
2 | CREATE DATABASE CH07_MAPPING_INHERITANCE;
3 |
--------------------------------------------------------------------------------
/Ch07/mapping-inheritance-embeddable/src/main/java/com/manning/javapersistence/ch07/repositories/ItemRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch07.repositories;
22 |
23 | import com.manning.javapersistence.ch07.model.Item;
24 | import org.springframework.data.jpa.repository.JpaRepository;
25 |
26 | public interface ItemRepository extends JpaRepository
- {
27 | }
28 |
--------------------------------------------------------------------------------
/Ch07/mapping-inheritance-manytoone/src/main/java/com/manning/javapersistence/ch07/repositories/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch07.repositories;
22 |
23 | import com.manning.javapersistence.ch07.model.User;
24 | import org.springframework.data.jpa.repository.JpaRepository;
25 |
26 | public interface UserRepository extends JpaRepository {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Ch07/mapping-inheritance-mappedsuperclass/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch07/mapping-inheritance-mappedsuperclass/src/test/resources/hibernate.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 | com.mysql.cj.jdbc.Driver
8 |
9 |
10 | jdbc:mysql://localhost:3306/CH07_MAPPING_INHERITANCE?serverTimezone=UTC
11 |
12 | root
13 |
14 | 50
15 | true
16 | create
17 |
18 |
--------------------------------------------------------------------------------
/Ch07/mapping-inheritance-onetomany/src/main/java/com/manning/javapersistence/ch07/repositories/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch07.repositories;
22 |
23 | import com.manning.javapersistence.ch07.model.User;
24 | import org.springframework.data.jpa.repository.JpaRepository;
25 |
26 | public interface UserRepository extends JpaRepository {
27 | }
28 |
--------------------------------------------------------------------------------
/Ch07/mapping-inheritance-singletable/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch07/mapping-inheritance-singletable/src/test/resources/hibernate.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 | com.mysql.cj.jdbc.Driver
8 |
9 |
10 | jdbc:mysql://localhost:3306/CH07_MAPPING_INHERITANCE?serverTimezone=UTC
11 |
12 | root
13 |
14 | 50
15 | true
16 | create
17 |
18 |
--------------------------------------------------------------------------------
/Ch07/mapping-inheritance-singletableformula/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch07/mapping-inheritance-singletableformula/src/test/resources/hibernate.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 | com.mysql.cj.jdbc.Driver
8 |
9 |
10 | jdbc:mysql://localhost:3306/CH07_MAPPING_INHERITANCE?serverTimezone=UTC
11 |
12 | root
13 |
14 | 50
15 | true
16 | create
17 |
18 |
--------------------------------------------------------------------------------
/Ch07/mapping-inheritance-tableperclass/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch07/mapping-inheritance-tableperclass/src/test/resources/hibernate.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 | com.mysql.cj.jdbc.Driver
8 |
9 |
10 | jdbc:mysql://localhost:3306/CH07_MAPPING_INHERITANCE?serverTimezone=UTC
11 |
12 | root
13 |
14 | 50
15 | true
16 | create
17 |
18 |
--------------------------------------------------------------------------------
/Ch08/Ch08.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH08_MAPPING_COLLECTIONS;
2 | CREATE DATABASE CH08_MAPPING_COLLECTIONS;
3 |
4 | DROP DATABASE IF EXISTS CH08_MAPPING_ASSOCIATIONS;
5 | CREATE DATABASE CH08_MAPPING_ASSOCIATIONS;
6 |
--------------------------------------------------------------------------------
/Ch08/mapping-associations/src/main/java/com/manning/javapersistence/ch08/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch08;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch08/mapping-collections/src/main/java/com/manning/javapersistence/ch08/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch08;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/manytomany-bidirectional/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/manytomany-linkentity/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/manytomany-ternary/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/maps-mapkey/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/maps-ternary/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/onetomany-bag/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/onetomany-embeddable-jointable/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/onetomany-embeddable/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/onetomany-jointable/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/onetomany-list/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/onetoone-foreigngenerator/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/onetoone-foreignkey/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/onetoone-jointable/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch09/onetoone-jointable/src/main/java/com/manning/javapersistence/ch09/onetoone/jointable/ShipmentState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09.onetoone.jointable;
22 |
23 | public enum ShipmentState {
24 |
25 | TRANSIT,
26 | CONFIRMED
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Ch09/onetoone-sharedprimarykey/src/main/java/com/manning/javapersistence/ch09/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch09;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch10/Ch10.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH10_MANAGING_DATA;
2 | CREATE DATABASE CH10_MANAGING_DATA;
3 |
4 | DROP DATABASE IF EXISTS CH10_MANAGING_DATA_REPLICATE;
5 | CREATE DATABASE CH10_MANAGING_DATA_REPLICATE;
6 |
7 | DROP DATABASE IF EXISTS CH10_MANAGING_DATA2;
8 | CREATE DATABASE CH10_MANAGING_DATA2;
9 |
10 |
--------------------------------------------------------------------------------
/Ch10/managing-data/src/main/java/com/manning/javapersistence/ch10/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch10;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch10/managing-data2/src/main/java/com/manning/javapersistence/ch10/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch10;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch10/managing-data2/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch10/managing-data2/src/test/java/com/manning/javapersistence/ch10/FetchTestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch10;
22 |
23 | public class FetchTestData {
24 | TestData items;
25 | TestData users;
26 | }
27 |
--------------------------------------------------------------------------------
/Ch11/Ch11.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH11_TRANSACTIONS;
2 | CREATE DATABASE CH11_TRANSACTIONS;
3 |
4 | DROP DATABASE IF EXISTS CH11_TRANSACTIONS2;
5 | CREATE DATABASE CH11_TRANSACTIONS2;
6 |
7 | DROP DATABASE IF EXISTS CH11_TRANSACTIONS3;
8 | CREATE DATABASE CH11_TRANSACTIONS3;
9 |
10 | DROP DATABASE IF EXISTS CH11_TRANSACTIONS4;
11 | CREATE DATABASE CH11_TRANSACTIONS4;
12 |
13 | DROP DATABASE IF EXISTS CH11_TRANSACTIONS5;
14 | CREATE DATABASE CH11_TRANSACTIONS5;
--------------------------------------------------------------------------------
/Ch11/transactions/src/main/java/com/manning/javapersistence/ch11/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch11;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch11/transactions/src/main/java/com/manning/javapersistence/ch11/concurrency/InvalidBidException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch11.concurrency;
22 |
23 | public class InvalidBidException extends Exception {
24 | public InvalidBidException(String message) {
25 | super(message);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Ch11/transactions/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch11/transactions/src/test/java/com/manning/javapersistence/ch11/concurrency/ConcurrencyTestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch11.concurrency;
22 |
23 | public class ConcurrencyTestData {
24 | TestData categories;
25 | TestData items;
26 | }
27 |
--------------------------------------------------------------------------------
/Ch11/transactions2/src/main/java/com/manning/javapersistence/ch11/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch11;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch11/transactions2/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch11/transactions3/src/main/java/com/manning/javapersistence/ch11/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch11;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch11/transactions3/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch11/transactions4/src/main/java/com/manning/javapersistence/ch11/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch11;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch11/transactions4/src/main/java/com/manning/javapersistence/ch11/concurrency/InvalidBidException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch11.concurrency;
22 |
23 | public class InvalidBidException extends Exception {
24 | public InvalidBidException(String message) {
25 | super(message);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Ch11/transactions4/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch11/transactions5-springdata/src/main/java/com/manning/javapersistence/ch11/exceptions/DuplicateItemNameException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch11.exceptions;
22 |
23 | public class DuplicateItemNameException extends RuntimeException {
24 |
25 | public DuplicateItemNameException(String message) {
26 | super(message);
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Ch11/transactions5-springdata/src/main/java/com/manning/javapersistence/ch11/repositories/LogRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch11.repositories;
22 |
23 | import com.manning.javapersistence.ch11.concurrency.Log;
24 | import org.springframework.data.jpa.repository.JpaRepository;
25 |
26 | public interface LogRepository extends JpaRepository, LogRepositoryCustom {
27 | }
28 |
--------------------------------------------------------------------------------
/Ch11/transactions5-springdata/src/main/java/com/manning/javapersistence/ch11/repositories/LogRepositoryCustom.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch11.repositories;
22 |
23 | public interface LogRepositoryCustom {
24 |
25 | void log(String message);
26 |
27 | void showLogs();
28 |
29 | void addSeparateLogsNotSupported();
30 |
31 | void addSeparateLogsSupports();
32 | }
33 |
--------------------------------------------------------------------------------
/Ch12/Ch12.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH12_FETCHING;
2 | CREATE DATABASE CH12_FETCHING;
3 |
4 | DROP DATABASE IF EXISTS CH12_FETCHING2;
5 | CREATE DATABASE CH12_FETCHING2;
6 |
7 | DROP DATABASE IF EXISTS CH12_FETCHING3;
8 | CREATE DATABASE CH12_FETCHING3;
9 |
10 | DROP DATABASE IF EXISTS CH12_FETCHING4;
11 | CREATE DATABASE CH12_FETCHING4;
12 |
13 | DROP DATABASE IF EXISTS CH12_FETCHING5;
14 | CREATE DATABASE CH12_FETCHING5;
15 |
16 | DROP DATABASE IF EXISTS CH12_FETCHING6;
17 | CREATE DATABASE CH12_FETCHING6;
18 |
19 | DROP DATABASE IF EXISTS CH12_FETCHING7;
20 | CREATE DATABASE CH12_FETCHING7;
21 |
22 | DROP DATABASE IF EXISTS CH12_FETCHING8;
23 | CREATE DATABASE CH12_FETCHING8;
24 |
25 | DROP DATABASE IF EXISTS CH12_FETCHING8_1;
26 | CREATE DATABASE CH12_FETCHING8_1;
27 |
28 | DROP DATABASE IF EXISTS CH12_FETCHING8_2;
29 | CREATE DATABASE CH12_FETCHING8_2;
30 |
31 | DROP DATABASE IF EXISTS CH12_FETCHING9;
32 | CREATE DATABASE CH12_FETCHING9;
33 |
34 | DROP DATABASE IF EXISTS CH12_FETCHING10;
35 | CREATE DATABASE CH12_FETCHING10;
--------------------------------------------------------------------------------
/Ch12/batch/src/main/java/com/manning/javapersistence/ch12/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch12/batch/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch12/batch/src/test/java/com/manning/javapersistence/ch12/batch/FetchTestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12.batch;
22 |
23 | public class FetchTestData {
24 | TestData items;
25 | TestData users;
26 | }
27 |
--------------------------------------------------------------------------------
/Ch12/cartesianproduct/src/main/java/com/manning/javapersistence/ch12/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch12/cartesianproduct/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch12/cartesianproduct/src/test/java/com/manning/javapersistence/ch12/cartesianproduct/FetchTestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12.cartesianproduct;
22 |
23 | public class FetchTestData {
24 | TestData items;
25 | TestData users;
26 | }
27 |
--------------------------------------------------------------------------------
/Ch12/eagerjoin/src/main/java/com/manning/javapersistence/ch12/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch12/eagerjoin/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch12/eagerjoin/src/test/java/com/manning/javapersistence/ch12/eagerjoin/FetchTestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12.eagerjoin;
22 |
23 | public class FetchTestData {
24 | TestData items;
25 | TestData users;
26 | }
27 |
--------------------------------------------------------------------------------
/Ch12/eagerselect/src/main/java/com/manning/javapersistence/ch12/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch12/eagerselect/src/test/java/com/manning/javapersistence/ch12/eagerselect/FetchTestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12.eagerselect;
22 |
23 | public class FetchTestData {
24 | TestData items;
25 | TestData users;
26 | }
27 |
--------------------------------------------------------------------------------
/Ch12/fetchloadgraph/src/main/java/com/manning/javapersistence/ch12/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch12/fetchloadgraph/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch12/fetchloadgraph/src/test/java/com/manning/javapersistence/ch12/fetchloadgraph/FetchTestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12.fetchloadgraph;
22 |
23 | public class FetchTestData {
24 | TestData items;
25 | TestData bids;
26 | TestData users;
27 | }
28 |
--------------------------------------------------------------------------------
/Ch12/nplusoneselects/src/main/java/com/manning/javapersistence/ch12/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch12/nplusoneselects/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch12/nplusoneselects/src/test/java/com/manning/javapersistence/ch12/nplusoneselects/FetchTestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12.nplusoneselects;
22 |
23 | public class FetchTestData {
24 | TestData items;
25 | TestData users;
26 | }
27 |
--------------------------------------------------------------------------------
/Ch12/profile/src/main/java/com/manning/javapersistence/ch12/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch12/profile/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch12/profile/src/test/java/com/manning/javapersistence/ch12/profile/FetchTestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12.profile;
22 |
23 | public class FetchTestData {
24 | TestData items;
25 | TestData users;
26 | }
27 |
--------------------------------------------------------------------------------
/Ch12/proxy/src/main/java/com/manning/javapersistence/ch12/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch12/proxy/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch12/proxy/src/test/java/com/manning/javapersistence/ch12/proxy/FetchTestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12.proxy;
22 |
23 | public class FetchTestData {
24 | TestData items;
25 | TestData users;
26 | }
27 |
--------------------------------------------------------------------------------
/Ch12/subselect/src/main/java/com/manning/javapersistence/ch12/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch12/subselect/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch12/subselect/src/test/java/com/manning/javapersistence/ch12/subselect/FetchTestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch12.subselect;
22 |
23 | public class FetchTestData {
24 | TestData items;
25 | TestData users;
26 | }
27 |
--------------------------------------------------------------------------------
/Ch13/Ch13.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH13_CASCADE;
2 | CREATE DATABASE CH13_CASCADE;
3 |
4 | DROP DATABASE IF EXISTS CH13_CALLBACK;
5 | CREATE DATABASE CH13_CALLBACK;
6 |
7 | DROP DATABASE IF EXISTS CH13_INTERCEPTOR;
8 | CREATE DATABASE CH13_INTERCEPTOR;
9 |
10 | DROP DATABASE IF EXISTS CH13_ENVERS;
11 | CREATE DATABASE CH13_ENVERS;
12 |
13 | DROP DATABASE IF EXISTS CH13_DYNAMIC;
14 | CREATE DATABASE CH13_DYNAMIC;
--------------------------------------------------------------------------------
/Ch13/callback/src/main/java/com/manning/javapersistence/ch13/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch13;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch13/callback/src/main/java/com/manning/javapersistence/ch13/filtering/callback/CurrentUser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch13.filtering.callback;
22 |
23 | public class CurrentUser extends ThreadLocal {
24 |
25 | public static CurrentUser INSTANCE = new CurrentUser();
26 |
27 | private CurrentUser() {
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Ch13/callback/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Ch13/cascade/src/main/java/com/manning/javapersistence/ch13/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch13;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch13/dynamic/src/main/java/com/manning/javapersistence/ch13/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch13;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch13/dynamic/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Ch13/envers/src/main/java/com/manning/javapersistence/ch13/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch13;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch13/envers/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Ch13/interceptor/src/main/java/com/manning/javapersistence/ch13/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch13;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch13/interceptor/src/main/java/com/manning/javapersistence/ch13/filtering/interceptor/Auditable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch13.filtering.interceptor;
22 |
23 | public interface Auditable {
24 | Long getId();
25 | }
26 |
--------------------------------------------------------------------------------
/Ch13/interceptor/src/test/java/com/manning/javapersistence/ch13/filtering/SecurityLoadListener.java:
--------------------------------------------------------------------------------
1 | package com.manning.javapersistence.ch13.filtering;
2 |
3 | import org.hibernate.HibernateException;
4 | import org.hibernate.event.internal.DefaultLoadEventListener;
5 | import org.hibernate.event.spi.LoadEvent;
6 |
7 | import java.io.Serializable;
8 |
9 | public class SecurityLoadListener extends DefaultLoadEventListener {
10 |
11 | @Override
12 | public void onLoad(LoadEvent event, LoadType loadType)
13 | throws HibernateException {
14 |
15 | boolean authorized =
16 | MySecurity.isAuthorized(
17 | event.getEntityClassName(), event.getEntityId()
18 | );
19 |
20 | if (!authorized) {
21 | throw new MySecurityException("Unauthorized access");
22 | }
23 |
24 | super.onLoad(event, loadType);
25 | }
26 |
27 | public static class MySecurity {
28 | static boolean isAuthorized(String entityName, Serializable entityId) {
29 | return true;
30 | }
31 | }
32 |
33 | public static class MySecurityException extends RuntimeException {
34 | public MySecurityException(String message) {
35 | super(message);
36 | }
37 | }
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/Ch14/Ch14.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH14_SPRING_HIBERNATE;
2 | CREATE DATABASE CH14_SPRING_HIBERNATE;
3 |
4 |
--------------------------------------------------------------------------------
/Ch14/spring-hibernate-dao-gen/src/main/java/com/manning/javapersistence/ch14/dao/BidDaoImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch14.dao;
22 |
23 | import com.manning.javapersistence.ch14.Bid;
24 |
25 | public class BidDaoImpl extends AbstractGenericDao {
26 |
27 | public BidDaoImpl() {
28 | setClazz(Bid.class);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/Ch14/spring-jpa-dao-gen/src/main/java/com/manning/javapersistence/ch14/dao/BidDaoImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch14.dao;
22 |
23 | import com.manning.javapersistence.ch14.Bid;
24 |
25 | public class BidDaoImpl extends AbstractGenericDao {
26 |
27 | public BidDaoImpl() {
28 | setClazz(Bid.class);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/Ch14/spring-jpa-dao-gen/src/test/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 | com.manning.javapersistence.ch14.Item
9 | com.manning.javapersistence.ch14.Bid
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Ch14/spring-jpa-dao/src/test/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 | com.manning.javapersistence.ch14.Item
9 | com.manning.javapersistence.ch14.Bid
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Ch15/Ch15.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH15_SPRINGDATAJDBC;
2 | CREATE DATABASE CH15_SPRINGDATAJDBC;
3 |
4 | DROP DATABASE IF EXISTS CH15_SPRINGDATAJDBC2;
5 | CREATE DATABASE CH15_SPRINGDATAJDBC2;
6 |
7 | DROP DATABASE IF EXISTS CH15_SPRINGDATAJDBC3;
8 | CREATE DATABASE CH15_SPRINGDATAJDBC3;
9 |
10 | DROP DATABASE IF EXISTS CH15_SPRINGDATAJDBC4;
11 | CREATE DATABASE CH15_SPRINGDATAJDBC4;
12 |
13 | DROP DATABASE IF EXISTS CH15_SPRINGDATAJDBC5;
14 | CREATE DATABASE CH15_SPRINGDATAJDBC5;
15 |
16 | DROP DATABASE IF EXISTS CH15_SPRINGDATAJDBC6;
17 | CREATE DATABASE CH15_SPRINGDATAJDBC6;
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/#build-image)
9 | * [Spring Data JDBC](https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Using Spring Data JDBC](https://github.com/spring-projects/spring-data-examples/tree/master/jdbc/basics)
15 |
16 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://localhost:3306/CH15_SPRINGDATAJDBC?serverTimezone=UTC
2 | spring.datasource.username=root
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
5 | spring.sql.init.mode=always
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS USERS;
2 |
3 | CREATE TABLE USERS (
4 | ID INTEGER AUTO_INCREMENT PRIMARY KEY,
5 | USERNAME VARCHAR(30),
6 | REGISTRATION_DATE DATE
7 | );
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc2/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/#build-image)
9 | * [Spring Data JDBC](https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Using Spring Data JDBC](https://github.com/spring-projects/spring-data-examples/tree/master/jdbc/basics)
15 |
16 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc2/src/main/resources/META-INF/ jdbc-named-queries.properties:
--------------------------------------------------------------------------------
1 | User.findUsersByLevel=SELECT USERNAME FROM USERS WHERE LEVEL = :LEVEL
2 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc2/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://localhost:3306/CH15_SPRINGDATAJDBC2?serverTimezone=UTC
2 | spring.datasource.username=root
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
5 | spring.sql.init.mode=always
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc2/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS USERS;
2 |
3 | CREATE TABLE USERS (
4 | ID INTEGER AUTO_INCREMENT PRIMARY KEY,
5 | ACTIVE BOOLEAN,
6 | USERNAME VARCHAR(30),
7 | EMAIL VARCHAR(30),
8 | LEVEL INTEGER,
9 | REGISTRATION_DATE DATE
10 | );
11 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc3/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/#build-image)
9 | * [Spring Data JDBC](https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Using Spring Data JDBC](https://github.com/spring-projects/spring-data-examples/tree/master/jdbc/basics)
15 |
16 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc3/src/main/java/com/manning/javapersistence/ch15/repositories/UserOneToOneRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.ch15.repositories;
22 |
23 | import com.manning.javapersistence.ch15.model.User;
24 | import org.springframework.data.repository.CrudRepository;
25 |
26 | public interface UserOneToOneRepository extends CrudRepository {
27 |
28 | }
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc3/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://localhost:3306/CH15_SPRINGDATAJDBC3?serverTimezone=UTC
2 | spring.datasource.username=root
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
5 | spring.sql.init.mode=always
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc3/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS ADDRESSES;
2 | DROP TABLE IF EXISTS USERS;
3 |
4 | CREATE TABLE USERS (
5 | ID INTEGER AUTO_INCREMENT PRIMARY KEY,
6 | ACTIVE BOOLEAN,
7 | USERNAME VARCHAR(30),
8 | EMAIL VARCHAR(30),
9 | LEVEL INTEGER,
10 | REGISTRATION_DATE DATE
11 | );
12 |
13 | CREATE TABLE ADDRESSES (
14 | USER_ID INTEGER AUTO_INCREMENT PRIMARY KEY,
15 | STREET VARCHAR(30) NOT NULL,
16 | CITY VARCHAR(20) NOT NULL
17 | );
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc4/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/#build-image)
9 | * [Spring Data JDBC](https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Using Spring Data JDBC](https://github.com/spring-projects/spring-data-examples/tree/master/jdbc/basics)
15 |
16 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc4/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://localhost:3306/CH15_SPRINGDATAJDBC4?serverTimezone=UTC
2 | spring.datasource.username=root
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
5 | spring.sql.init.mode=always
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc4/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS USERS;
2 |
3 | CREATE TABLE USERS (
4 | ID INTEGER AUTO_INCREMENT PRIMARY KEY,
5 | ACTIVE BOOLEAN,
6 | USERNAME VARCHAR(30),
7 | EMAIL VARCHAR(30),
8 | LEVEL INTEGER,
9 | REGISTRATION_DATE DATE,
10 | STREET VARCHAR(30) NOT NULL,
11 | CITY VARCHAR(20) NOT NULL
12 | );
13 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc5/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/#build-image)
9 | * [Spring Data JDBC](https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Using Spring Data JDBC](https://github.com/spring-projects/spring-data-examples/tree/master/jdbc/basics)
15 |
16 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc5/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://localhost:3306/CH15_SPRINGDATAJDBC5?serverTimezone=UTC
2 | spring.datasource.username=root
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
5 | spring.sql.init.mode=always
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc5/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS ADDRESSES;
2 | DROP TABLE IF EXISTS USERS;
3 |
4 | CREATE TABLE USERS (
5 | ID INTEGER AUTO_INCREMENT PRIMARY KEY,
6 | ACTIVE BOOLEAN,
7 | USERNAME VARCHAR(30),
8 | EMAIL VARCHAR(30),
9 | LEVEL INTEGER,
10 | REGISTRATION_DATE DATE
11 | );
12 |
13 | CREATE TABLE ADDRESSES (
14 | ID INTEGER AUTO_INCREMENT PRIMARY KEY,
15 | USER_ID INTEGER,
16 | STREET VARCHAR(30) NOT NULL,
17 | CITY VARCHAR(20) NOT NULL,
18 | FOREIGN KEY (USER_ID)
19 | REFERENCES USERS(ID)
20 | ON DELETE CASCADE
21 | );
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc6/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/#build-image)
9 | * [Spring Data JDBC](https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Using Spring Data JDBC](https://github.com/spring-projects/spring-data-examples/tree/master/jdbc/basics)
15 |
16 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc6/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://localhost:3306/CH15_SPRINGDATAJDBC6?serverTimezone=UTC
2 | spring.datasource.username=root
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
5 | spring.sql.init.mode=always
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Ch15/spring-data-jdbc6/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS USERS_ADDRESSES;
2 | DROP TABLE IF EXISTS USERS;
3 | DROP TABLE IF EXISTS ADDRESSES;
4 |
5 | CREATE TABLE USERS (
6 | ID INTEGER AUTO_INCREMENT PRIMARY KEY,
7 | ACTIVE BOOLEAN,
8 | USERNAME VARCHAR(30),
9 | EMAIL VARCHAR(30),
10 | LEVEL INTEGER,
11 | REGISTRATION_DATE DATE
12 | );
13 |
14 | CREATE TABLE ADDRESSES (
15 | ID INTEGER AUTO_INCREMENT PRIMARY KEY,
16 | STREET VARCHAR(30) NOT NULL,
17 | CITY VARCHAR(20) NOT NULL
18 | );
19 |
20 | CREATE TABLE USERS_ADDRESSES (
21 | USER_ID INTEGER,
22 | ADDRESS_ID INTEGER,
23 | FOREIGN KEY (USER_ID)
24 | REFERENCES USERS(ID)
25 | ON DELETE CASCADE,
26 | FOREIGN KEY (ADDRESS_ID)
27 | REFERENCES ADDRESSES(ID)
28 | ON DELETE CASCADE
29 | );
30 |
31 |
--------------------------------------------------------------------------------
/Ch16/Ch16.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH16_SPRINGDATAREST;
2 | CREATE DATABASE CH16_SPRINGDATAREST;
3 |
4 |
--------------------------------------------------------------------------------
/Ch16/spring-data-rest-events/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8081
2 | spring.datasource.url=jdbc:mysql://localhost:3306/CH16_SPRINGDATAREST?serverTimezone=UTC
3 | spring.datasource.username=root
4 | spring.datasource.password=
5 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
6 | spring.jpa.show-sql=true
7 | spring.jpa.hibernate.ddl-auto=create
8 |
9 |
--------------------------------------------------------------------------------
/Ch16/spring-data-rest-events/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | # Root logger option
2 | log4j.rootLogger=DEBUG, stdout
3 |
4 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
5 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
6 | log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
--------------------------------------------------------------------------------
/Ch16/spring-data-rest-events/src/main/resources/rest/commands.rest:
--------------------------------------------------------------------------------
1 | ###
2 | GET http://localhost:8081/users
3 |
4 | ###
5 | GET http://localhost:8081/users/1
6 |
7 | ###
8 | PATCH http://localhost:8081/users/1
9 | Content-Type: application/json
10 |
11 | {
12 | "name": "Amelia Jones",
13 | "isRegistered": "true"
14 | }
15 |
16 | ###
17 | DELETE http://localhost:8081/users/1
18 |
19 | ###
20 | POST http://localhost:8081/users
21 | Content-Type: application/json
22 |
23 | {
24 | "name": "John Smith"
25 | }
26 |
27 | ###
28 | GET http://localhost:8081/users/1
29 | If-None-Match: "0"
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Ch16/spring-data-rest-events/src/main/resources/users_information.csv:
--------------------------------------------------------------------------------
1 | John Smith
2 | Jane Underwood
3 | James Perkins
4 | Mary Calderon
5 | Noah Graves
6 | Jake Chavez
7 | Oliver Aguilar
8 | Emma Mccann
9 | Margaret Knight
10 | Amelia Curry
11 | Jack Vaughn
12 | Liam Lewis
13 | Olivia Reyes
14 | Samantha Poole
15 | Patricia Jordan
16 | Robert Sherman
17 | Mason Burton
18 | Harry Christensen
19 | Jennifer Mills
20 | Sophia Graham
21 |
--------------------------------------------------------------------------------
/Ch16/spring-data-rest-projections/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8081
2 | spring.datasource.url=jdbc:mysql://localhost:3306/CH16_SPRINGDATAREST?serverTimezone=UTC
3 | spring.datasource.username=root
4 | spring.datasource.password=
5 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
6 | spring.jpa.show-sql=true
7 | spring.jpa.hibernate.ddl-auto=create
8 |
9 |
--------------------------------------------------------------------------------
/Ch16/spring-data-rest-projections/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | # Root logger option
2 | log4j.rootLogger=DEBUG, stdout
3 |
4 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
5 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
6 | log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
--------------------------------------------------------------------------------
/Ch16/spring-data-rest-projections/src/main/resources/rest/commands.rest:
--------------------------------------------------------------------------------
1 | ###
2 | GET http://localhost:8081/users
3 |
4 | ###
5 | GET http://localhost:8081/users/1
6 |
7 | ###
8 | GET http://localhost:8081/users/1?projection=summary
9 |
10 | ###
11 | PATCH http://localhost:8081/users/1
12 | Content-Type: application/json
13 |
14 | {
15 | "name": "Amelia Jones",
16 | "isRegistered": "true"
17 | }
18 |
19 | ###
20 | DELETE http://localhost:8081/users/1
21 |
22 | ###
23 | POST http://localhost:8081/users
24 | Content-Type: application/json
25 |
26 | {
27 | "name": "John Smith",
28 | "isRegistered": "true",
29 | "address": {"street":"55 Flowers Streets", "zipCode":"12345", "city":"Boston", "state":"MA"}
30 | }
31 |
32 | ###
33 | GET http://localhost:8081/users/1
34 | If-None-Match: "0"
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Ch16/spring-data-rest-projections/src/main/resources/users_information.csv:
--------------------------------------------------------------------------------
1 | John Smith
2 | Jane Underwood
3 | James Perkins
4 | Mary Calderon
5 | Noah Graves
6 | Jake Chavez
7 | Oliver Aguilar
8 | Emma Mccann
9 | Margaret Knight
10 | Amelia Curry
11 | Jack Vaughn
12 | Liam Lewis
13 | Olivia Reyes
14 | Samantha Poole
15 | Patricia Jordan
16 | Robert Sherman
17 | Mason Burton
18 | Harry Christensen
19 | Jennifer Mills
20 | Sophia Graham
21 |
--------------------------------------------------------------------------------
/Ch16/spring-data-rest/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8081
2 | spring.datasource.url=jdbc:mysql://localhost:3306/CH16_SPRINGDATAREST?serverTimezone=UTC
3 | spring.datasource.username=root
4 | spring.datasource.password=
5 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
6 | spring.jpa.show-sql=true
7 | spring.jpa.hibernate.ddl-auto=create
8 |
9 |
--------------------------------------------------------------------------------
/Ch16/spring-data-rest/src/main/resources/rest/commands.rest:
--------------------------------------------------------------------------------
1 | ###
2 | GET http://localhost:8081/users
3 |
4 | ###
5 | GET http://localhost:8081/users/1
6 |
7 | ###
8 | PATCH http://localhost:8081/users/1
9 | Content-Type: application/json
10 |
11 | {
12 | "name": "Amelia Jones",
13 | "isRegistered": "true"
14 | }
15 |
16 | ###
17 | DELETE http://localhost:8081/users/1
18 |
19 | ###
20 | POST http://localhost:8081/users
21 | Content-Type: application/json
22 |
23 | {
24 | "name": "John Smith"
25 | }
26 |
27 | ###
28 | GET http://localhost:8081/users/1
29 | If-None-Match: "0"
--------------------------------------------------------------------------------
/Ch16/spring-data-rest/src/main/resources/users_information.csv:
--------------------------------------------------------------------------------
1 | John Smith
2 | Jane Underwood
3 | James Perkins
4 | Mary Calderon
5 | Noah Graves
6 | Jake Chavez
7 | Oliver Aguilar
8 | Emma Mccann
9 | Margaret Knight
10 | Amelia Curry
11 | Jack Vaughn
12 | Liam Lewis
13 | Olivia Reyes
14 | Samantha Poole
15 | Patricia Jordan
16 | Robert Sherman
17 | Mason Burton
18 | Harry Christensen
19 | Jennifer Mills
20 | Sophia Graham
21 |
--------------------------------------------------------------------------------
/Ch17/springdatamongodb/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.1/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.1/maven-plugin/reference/html/#build-image)
9 | * [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/2.6.1/reference/htmlsingle/#boot-features-mongodb)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Accessing Data with MongoDB](https://spring.io/guides/gs/accessing-data-mongodb/)
15 |
16 |
--------------------------------------------------------------------------------
/Ch17/springdatamongodb/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | logging.level.org.springframework.data.mongodb.core.MongoTemplate=DEBUG
2 | spring.data.mongodb.auto-index-creation=true
3 | spring.data.mongodb.host=localhost
4 | spring.data.mongodb.port=27017
--------------------------------------------------------------------------------
/Ch17/springdatamongodb2/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.1/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.1/maven-plugin/reference/html/#build-image)
9 | * [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/2.6.1/reference/htmlsingle/#boot-features-mongodb)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Accessing Data with MongoDB](https://spring.io/guides/gs/accessing-data-mongodb/)
15 |
16 |
--------------------------------------------------------------------------------
/Ch17/springdatamongodb2/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | logging.level.org.springframework.data.mongodb.core.MongoTemplate=DEBUG
2 | spring.data.mongodb.auto-index-creation = true
3 | spring.data.mongodb.host=localhost
4 | spring.data.mongodb.port=27017
--------------------------------------------------------------------------------
/Ch17/springdatamongodb3/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.1/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.1/maven-plugin/reference/html/#build-image)
9 | * [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/2.6.1/reference/htmlsingle/#boot-features-mongodb)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Accessing Data with MongoDB](https://spring.io/guides/gs/accessing-data-mongodb/)
15 |
16 |
--------------------------------------------------------------------------------
/Ch17/springdatamongodb3/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | logging.level.org.springframework.data.mongodb.core.MongoTemplate=DEBUG
2 | spring.data.mongodb.auto-index-creation=true
3 | spring.data.mongodb.host=localhost
4 | spring.data.mongodb.port=27017
5 |
--------------------------------------------------------------------------------
/Ch19/Ch19.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH19_QUERYDSL;
2 | CREATE DATABASE CH19_QUERYDSL;
3 |
--------------------------------------------------------------------------------
/Ch19/querydsl/src/main/java/com/manning/javapersistence/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence;
22 |
23 | public class Constants {
24 | public static final String ID_GENERATOR = "ID_GENERATOR";
25 | }
26 |
--------------------------------------------------------------------------------
/Ch19/querydsl/src/main/java/com/manning/javapersistence/querydsl/repositories/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.querydsl.repositories;
22 |
23 | import com.manning.javapersistence.querydsl.model.User;
24 | import org.springframework.data.jpa.repository.JpaRepository;
25 |
26 | public interface UserRepository extends JpaRepository {
27 | }
28 |
--------------------------------------------------------------------------------
/Ch19/querydsl/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Ch20/1 spring testing/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.5.6/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.5.6/maven-plugin/reference/html/#build-image)
9 | * [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.5.6/reference/htmlsingle/#boot-features-jpa-and-spring-data)
10 | * [Validation](https://docs.spring.io/spring-boot/docs/2.5.6/reference/htmlsingle/#boot-features-validation)
11 |
12 | ### Guides
13 | The following guides illustrate how to use some features concretely:
14 |
15 | * [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)
16 | * [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
17 |
18 |
--------------------------------------------------------------------------------
/Ch20/1 spring testing/src/main/java/com/manning/javapersistence/testing/repositories/LogRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.testing.repositories;
22 |
23 | import com.manning.javapersistence.testing.model.Log;
24 | import org.springframework.data.jpa.repository.JpaRepository;
25 |
26 | public interface LogRepository extends JpaRepository {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Ch20/1 spring testing/src/main/java/com/manning/javapersistence/testing/repositories/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.testing.repositories;
22 |
23 | import com.manning.javapersistence.testing.model.User;
24 | import org.springframework.data.jpa.repository.JpaRepository;
25 |
26 | public interface UserRepository extends JpaRepository {
27 | }
28 |
--------------------------------------------------------------------------------
/Ch20/1 spring testing/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://localhost:3306/CH20_TESTING?serverTimezone=UTC
2 | spring.datasource.username=root
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
5 | #spring.datasource.url=jdbc:h2:mem:integrationtesting
6 | #spring.datasource.username=sa
7 | #spring.datasource.password=
8 | #spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
9 | spring.jpa.show-sql=true
10 | spring.jpa.hibernate.ddl-auto=create
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Ch20/1 spring testing/src/test/resources/config.properties:
--------------------------------------------------------------------------------
1 | iterations=100
--------------------------------------------------------------------------------
/Ch20/2 spring profiles/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.5.6/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.5.6/maven-plugin/reference/html/#build-image)
9 | * [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.5.6/reference/htmlsingle/#boot-features-jpa-and-spring-data)
10 | * [Validation](https://docs.spring.io/spring-boot/docs/2.5.6/reference/htmlsingle/#boot-features-validation)
11 |
12 | ### Guides
13 | The following guides illustrate how to use some features concretely:
14 |
15 | * [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)
16 | * [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
17 |
18 |
--------------------------------------------------------------------------------
/Ch20/2 spring profiles/src/main/java/com/manning/javapersistence/testing/repositories/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.testing.repositories;
22 |
23 | import com.manning.javapersistence.testing.model.User;
24 | import org.springframework.data.jpa.repository.JpaRepository;
25 |
26 | public interface UserRepository extends JpaRepository {
27 | }
28 |
--------------------------------------------------------------------------------
/Ch20/2 spring profiles/src/main/resources/application-dev.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:h2:mem:ch20_testing
2 | spring.datasource.username=sa
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
5 | spring.jpa.show-sql=true
6 | spring.jpa.hibernate.ddl-auto=create
--------------------------------------------------------------------------------
/Ch20/2 spring profiles/src/main/resources/application-prod.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://localhost:3306/CH20_TESTING?serverTimezone=UTC
2 | spring.datasource.username=root
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
5 | spring.jpa.show-sql=false
6 | spring.jpa.hibernate.ddl-auto=create
--------------------------------------------------------------------------------
/Ch20/2 spring profiles/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.profiles.active=prod
--------------------------------------------------------------------------------
/Ch20/2 spring profiles/src/test/resources/config.properties:
--------------------------------------------------------------------------------
1 | iterations=100
--------------------------------------------------------------------------------
/Ch20/3 spring listeners/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.5.6/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.5.6/maven-plugin/reference/html/#build-image)
9 | * [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.5.6/reference/htmlsingle/#boot-features-jpa-and-spring-data)
10 | * [Validation](https://docs.spring.io/spring-boot/docs/2.5.6/reference/htmlsingle/#boot-features-validation)
11 |
12 | ### Guides
13 | The following guides illustrate how to use some features concretely:
14 |
15 | * [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)
16 | * [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
17 |
18 |
--------------------------------------------------------------------------------
/Ch20/3 spring listeners/src/main/java/com/manning/javapersistence/testing/repositories/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ========================================================================
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one or more
5 | * contributor license agreements. See the NOTICE file distributed with
6 | * this work for additional information regarding copyright ownership.
7 | * The ASF licenses this file to You under the Apache License, Version 2.0
8 | * (the "License"); you may not use this file except in compliance with
9 | * the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * ========================================================================
20 | */
21 | package com.manning.javapersistence.testing.repositories;
22 |
23 | import com.manning.javapersistence.testing.model.User;
24 | import org.springframework.data.jpa.repository.JpaRepository;
25 |
26 | public interface UserRepository extends JpaRepository {
27 | }
28 |
--------------------------------------------------------------------------------
/Ch20/3 spring listeners/src/main/resources/application-dev.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:h2:mem:ch20_testing
2 | spring.datasource.username=sa
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
5 | spring.jpa.show-sql=true
6 | spring.jpa.hibernate.ddl-auto=create
--------------------------------------------------------------------------------
/Ch20/3 spring listeners/src/main/resources/application-prod.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://localhost:3306/CH20_TESTING?serverTimezone=UTC
2 | spring.datasource.username=root
3 | spring.datasource.password=
4 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
5 | spring.jpa.show-sql=false
6 | spring.jpa.hibernate.ddl-auto=create
--------------------------------------------------------------------------------
/Ch20/3 spring listeners/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.profiles.active=prod
--------------------------------------------------------------------------------
/Ch20/3 spring listeners/src/test/resources/config.properties:
--------------------------------------------------------------------------------
1 | iterations=100
--------------------------------------------------------------------------------
/Ch20/Ch20.sql:
--------------------------------------------------------------------------------
1 | DROP DATABASE IF EXISTS CH20_TESTING;
2 | CREATE DATABASE CH20_TESTING;
3 |
--------------------------------------------------------------------------------