Skip to content

io microsphere hibernate test entity UserProfile

github-actions[bot] edited this page Jul 23, 2026 · 8 revisions

UserProfile

Type: Class | Module: microsphere-hibernate-test | Package: io.microsphere.hibernate.test.entity | Since: 1.0.0

Source: microsphere-hibernate-test/src/main/java/io/microsphere/hibernate/test/entity/UserProfile.java

Overview

JPA entity representing a user's profile, mapped to the t_user_profile table. Holds additional personal information (e.g. ID card number) for a User.

Example Usage

`User user = new User();
  user.setName("Tom");

  UserProfile profile = new UserProfile();
  profile.setIdCard("ID123456");
  profile.setUser(user);
  user.setProfile(profile);

  // Persisting the user will cascade to the profile
  session.persist(user);
  UserProfile loaded = session.get(UserProfile.class, profile.getId());
`

Declaration

public class UserProfile

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.2.9-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

User user = new User();
  user.setName("Tom");

  UserProfile profile = new UserProfile();
  profile.setIdCard("ID123456");
  profile.setUser(user);
  user.setProfile(profile);

  // Persisting the user will cascade to the profile
  session.persist(user);
  UserProfile loaded = session.get(UserProfile.class, profile.getId());

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-hibernate-test</artifactId>
    <version>${microsphere-hibernate.version}</version>
</dependency>

Tip: Use the BOM (microsphere-hibernate-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.hibernate.test.entity.UserProfile;

API Reference

Public Methods

Method Description
getId Returns the surrogate primary key of this user profile.
setId Sets the surrogate primary key of this user profile.
getIdCard Returns the ID card number stored in this profile.
setIdCard Sets the ID card number for this profile.
getUser Returns the User that owns this profile.
setUser Sets the User that owns this profile.

Method Details

getId

public Long getId()

Returns the surrogate primary key of this user profile.

setId

public void setId(Long id)

Sets the surrogate primary key of this user profile.

See Also

  • User

This documentation was auto-generated from the source code of microsphere-hibernate.

Clone this wiki locally