Skip to main content

Posts

Showing posts from October, 2022

many to many mapping in hibernate

 many to many mapping in hibernate Directory Structure pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>Test</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>Test</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.9</maven.compiler.source> <maven.compiler.target>1.9</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId>

Hibernate One to Many Example using Annotation

 Hibernate One to Many Example using Annotation Directory Structure: pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>TimeStamp</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>TimeStamp</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.9</maven.compiler.source> <maven.compiler.target>1.9</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>ju

how to save creation and updation timestamp with hibernate.

 how to save creation and updation timestamp with hibernate. for explnation watch the video : Object time stamping feature of hibernate ========================================= ->this feature keeps track of the object/record is saved/inserted initially later it also keeps track of when record/object is lastly updated/modified =>Object versioning feature keeps track how many times the object/record is modified using Hibernate persistence logic where Object timestampping feature keeps track when exactly the Object/record is inserted and lastly updated. useCases for timeStampping ========================== ->Keeping the track of when the password lastly changed ->keeping the track of when stock market share values lastly updated/modified ->Keeping the track of when last tx happend in the bank account In annotation driven HB programming ==================================== ->we can enable timestamp,version features at a time on single entity class -> in timestamp feat