Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6099307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:15:31+00:00 2026-05-23T13:15:31+00:00

I’m developing a simple webapp based on Spring framework. I have these two files

  • 0

I’m developing a simple webapp based on Spring framework. I have these two files which are response for mapping database tables:

import javax.persistence.*;
import java.util.Date;

/**
 * Abstract class for all publications of BIS
 * @author Tomek Zaremba
 */

public abstract class GenericPost {

@Temporal(TemporalType.DATE)
@Column(name = "date_added")
private Date dateAdded;

@Column(name = "title")
private String title;

@Column(name = "description")
private String description;

/**
 *
 * @return title of publication
 */
public String getTitle() {
    return title;
}

/**
 *
 * @param title to be set for publication
 */
public void setTitle(String title) {
    this.title = title;
}

/**
 *
 * @return description of publication
 */
public String getDescription() {
    return description;
}

/**
 *
 * @param description of publication
 */
public void setDescription(String description) {
    this.description = description;
}

/**
 *
 * @return date when publication was added
 */
public Date getDateAdded() {
    return dateAdded;
}

/**
 *
 * @param dateAdded set the date of adding for publication
 */
public void setDateAdded(Date dateAdded) {
    this.dateAdded = dateAdded;
}
}

and another:

import javax.persistence.*;
import java.io.Serializable;

/**
 * Instances of Link represents and collects data about single link stored in BIS    database
 * @author Tomek Zaremba
 */
@Entity
@Table(name="Link", schema="public")
public class Link extends GenericPost implements Serializable{

@Id
@Column(name="id", unique=true)
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator="link_id_seq")
@SequenceGenerator(sequenceName="link_id_seq", name="link_id_seq")
private Integer id;

@Column(name="link")
private String link;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "author_user_id")
private User user;

/**
 *
 * @return id of link
 */
public Integer getId() {
    return id;
}

/**
 *
 * @param id to be set to link
 */
public void setId(Integer id) {
    this.id = id;
}

/**
 *
 * @return link which is connected with Link instance
 */
public String getLink() {
    return link;
}

/**
 *
 * @param link to be set fo Link instance
 */
public void setLink(String link) {
    this.link = link;
}

/**
 *
 * @return User instance connected with Link instance
 */
public User getUser() {
    return user;
}

/**
 *
 * @param user to be set for Link instance
 */
public void setUser(User user) {
    this.user = user;
}
}

The problem is: why when I’m using methods from generic class (getters) I always get null and when I use getters from Link class I get correct data? Database access is fine, the junit tests are passing without errors. Thanks for help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:15:31+00:00Added an answer on May 23, 2026 at 1:15 pm

    The GenericPost class should be annotated with @MappedSuperclass. Else, its persistence annotations are not taken into account by the mapping.

    Note : Your unit tests should probably be updated to check that the mapping of the super-class fields works as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.