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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:18:15+00:00 2026-06-02T02:18:15+00:00

I have some classes which are related. One them is have another classes’s object

  • 0

I have some classes which are related. One them is have another classes’s object set. Like this,

 @Entity
 public class Serving extends Model{

@Required
public Item item;
@Required
public Float amount;
@Required
public Date time;

public Serving(Item item, Float amount) {
    super();
    this.item = item;
    this.amount = amount;
    this.time = new Date();
}
}

 @Entity
 public class Receipt extends Model{

@Required
@ElementCollection
@NotNull
public Set<Serving> servings;
@Required
DiningTable dtable;

public Receipt(Set<Serving> servings, DiningTable dtable) {
    super();
    this.servings = servings;
    this.dtable = dtable;
}

//order'ın totalın hesaplamak lazım.

 }

and i also have some yaml data to initalize this.

Serving(ser1):
item : it1
amount : 1
time : 2012-04-05 12:10

Serving(ser2):
item : it2
amount : 0.5
time : 2012-04-05 12:11

Serving(ser3):
item : it3
amount : 2
time : 2012-04-04 13:10

Serving(ser4):
item : it4
amount : 1
time : 2012-04-04 13:10

Serving(ser5):
item : it5
amount : 0.5
time : 2012-04-04 14:00

Serving(ser6):
item : it6
amount : 1
time : 2012-04-04 14:10

Serving(ser7):
item : it7
amount : 1
time : 2012-04-03 16:00

Serving(ser8):
item : it8
amount : 2
time : 2012-04-03 16:01

Serving(ser9):
item : it9
amount : 1
time : 2012-04-03 16:30

Serving(ser10):
item : it2
amount : 1
time : 2012-04-02 17:00

Receipt(rec1):
dtable : tab1
servings :
– ser1
– ser2
– ser3

Receipt(rec2):
dtable : tab2
servings :
– ser4
– ser5

Receipt(rec3):
dtable : tab3
servings :
– ser6

Receipt(rec4):
dtable : tab4
servings :
– ser7
– ser8

Receipt(5):
dtable : tab4
servings :
– ser9
– ser10

When i tried to initialize this data it gives this error,

14:13:01,200 WARN ~ SQL Error: 1364, SQLState: HY000
14:13:01,200 ERROR ~ Field ‘servings_time’ doesn’t have a default value
14:13:01,200 ERROR ~ Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update

How can i resolve this problem?

  • 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-06-02T02:18:16+00:00Added an answer on June 2, 2026 at 2:18 am

    In serving class constructor must be get date as parameter.

    public Serving(Item item, Float amount, Date date) {
    super();
    this.item = item;
    this.amount = amount;
    this.time = date;
    }
    

    So i have to add this constructor too…

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

Sidebar

Related Questions

I have some classes(call it Class A) which I would like to unit test
I have some classes that, for one reason or another, cannot be or need
I came across a few articles like this one , which suggest that some
I have a set of related C++ classes which must be wrapped and exported
i have two classes which have some common methods like funcA(), funcB() and some
I have some classes which extends a superclass, and in the JSP I want
I have some classes which are parameterized via their constructor. I need to provide
I have some functionality that I need in all my classes which derive from
I'm using .NET 3.5. We have some complex third-party classes which are automatically generated
I have four classes which share some arrangement of four properties. I have currently

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.