Posts

Showing posts from April, 2016

Hibernate One To Many Mapping with Annotations

Database: CREATE TABLE `encountermessage` (   `ID` bigint(20) NOT NULL AUTO_INCREMENT,   `encounterID` bigint(20) NOT NULL,   `message` varchar(500) NOT NULL,   `version` bigint(20) DEFAULT '1',   `createdBy` bigint(20) NOT NULL,   `createdDate` datetime NOT NULL,   `updatedDate` datetime DEFAULT NULL,   `updatedBy` bigint(20) DEFAULT NULL,   PRIMARY KEY (`ID`),   KEY `FK_encountermessage_encounter` (`encounterID`),   KEY `FK_encountermessage_createdby` (`createdBy`),   CONSTRAINT `FK_encountermessage_createdby` FOREIGN KEY (`createdBy`) REFERENCES `users` (`ID`),   CONSTRAINT `FK_encountermessage_encounter` FOREIGN KEY (`encounterID`) REFERENCES `encounter` (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `encountermessageusr` (   `ID` bigint(20) NOT NULL AUTO_INCREMENT,   `messageID` bigint(20) NOT NULL,   `userID` bigint(20) NOT NULL,   `readDate` datetime NOT NULL,   PRIMARY KEY (`ID`),   KEY `encountermessageusr_messageID` (`messageID`),   KEY `encountermessageu…