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 7560713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:58:26+00:00 2026-05-30T12:58:26+00:00

Example:i have a database name base1,with one table(product) and data inside her:productid,name,price. How to

  • 0

Example:i have a database name base1,with one table(product) and data inside her:productid,name,price.
How to create a class for that table product?
Tnx in advance.

public class Product {
private int id;
private String name;
private double price;


public Product(String name) {
 this.name = name;
 this.id = id;
}

private String getName() {
  return name;
}

private String getId() {
  return id;
}

private double getPrice() {
 return price;
 }

i know how to create connection with database,and how to implements methods like insert,delete…but i’m having problem with creating a class.

or…something like this?

public class Proizvod {
private int id;
private String naziv;
private String sifra;

public Proizvod() {
}
public Proizvod(int id, String naziv, String sifra) {
    this.id = id;
    this.naziv = naziv;
    this.sifra = sifra;
}
private int getId() {
    return id;
}
private void setId(int id) {
    this.id = id;
}
private String getNaziv() {
    return naziv;
}
private void setNaziv(String naziv) {
    this.naziv = naziv;
}
private String getSifra() {
    return sifra;
}
private void setSifra(String sifra) {
    this.sifra = sifra;
}
public void prikaziPodatke() {
    System.out.println("Proizvod:" + naziv+""+id+""+sifra);
}
}
  • 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-30T12:58:27+00:00Added an answer on May 30, 2026 at 12:58 pm

    As npinti suggested, I strongly second take a look at Hibernate. With the Hibernate Tools, it generates all of the classes automatically. The first steps to make it running a little bit hard though. Hibernate Tools is a plugin can be installed into Eclipse, or Netbeans comes with it (it or a similar tool but does the same thing).

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

Sidebar

Related Questions

I have a database that contains a history of product sales. For example the
In my database I have tables that define types for example Table: Publication Types
Up until now, I have maintained a 'dictionary' table in my database, for example:
I have an example database, it contains tables for Movies, People and Credits. The
For example, if let's say I have a database of users. I have a
Does anybody have an example of working with database using Visual C++ and OLEDB?
If I have a collection of database tables (in an Access file, for example)
I have 2 websites, lets say - example.com and example1.com example.com has a database
I have a big doubt. Let's take as example a database for a whatever
Lets say I have a table with just two columns: name and mood .

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.