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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:30:59+00:00 2026-06-17T06:30:59+00:00

MODEL In the current model of my application, events can occur at several non-combinable

  • 0

MODEL

In the current model of my application, events can occur at several non-combinable frequencies, whose values are enumerated as follows: ONCE, DAILY, WEEKLY, MONTHLY, YEARLY, and that (i.e. the event occurrences) are starting at a certain date and optionally ending at a later one (when they’re not ending, their value is NULL).

For instance, an event:

  • happening YEARLY and WEEKLY
  • that started exactly n weeks ago in both cases
  • and whose end date is null

has:

  • a weekly occurrence right now
  • a yearly occurrence in (52 – n%52) weeks

USAGE

This data can be updated via a back-office very frequently. It is needed on our public pages in order to display a 3-day timetable of all event occurrences, gathered by 1-hour slots.

The default start of the timetable is the date of today at midnight.
The timetable start can go down to 1 month before the current date and 2 months after.

WHAT I NEED

All events data is inserted without any problem via the back-office.
The tricky part comes when I need to fetch them, organized in a timetable way. I tried a brute approach (select all event, and duplicating the occurrences myself) but I kinda failed (and this raises the issue of updated the big cache of replicated events whenever the data changes and everyday!).

What I really want from this beautiful model of mine (stupid me: I didn’t think of both the write AND read query at the same time) is to have all occurrences of events between beginning_date and end_date, organized by 1-hour slot.

What do you suggest ?

  1. Denormalize my model and find a tool that automagically syncs my “master” model to the re-organized model? Then, how do I first denormalize it? How do I sync it?
  2. Find a JPQL (or HQL, or raw SQL) query that can fetch all the replicated occurrences of events during the provided interval (+ maybe some post-processing to index them by 1-hour slots)? I’d be extremely happy if you could provide it to me 🙂
  3. something else?

By the way, the model is open, so it can be changed in order to better address the issue. Everything is open to discussion here.

Best regards,

Rolf

P.S.: the current (interesting part of the) model looks like:

mysql> describe occurrences;
+----------------+-------------+------+-----+---------+----------------+
| Field          | Type        | Null | Key | Default | Extra          |
+----------------+-------------+------+-----+---------+----------------+
| id             | bigint(20)  | NO   | PRI | NULL    | auto_increment |
| start_date     | datetime    | NO   |     | NULL    |                |
| end_date       | datetime    | YES  |     | NULL    |                |
| frequency_type | varchar(50) | NO   | MUL | NULL    |                |
| event_id       | bigint(20)  | NO   | MUL | NULL    |                |
+----------------+-------------+------+-----+---------+----------------+

mysql> describe frequency_types;
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| value | varchar(50) | NO   | PRI | NULL    |       |
+-------+-------------+------+-----+---------+-------+
  • 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-17T06:31:00+00:00Added an answer on June 17, 2026 at 6:31 am

    You can query all events occurring whose start is before the requested end and end is null OR after the requested beginning, and then replicate/calculate all events from the result set.

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

Sidebar

Related Questions

We are using a pub-sub model in our WCF application that pretty much follows
I'm trying to change my current application to scale. It can currently handle at
Is it possible to auto-rotate the default application image according to current landscape mode?
My current head scratcher: implementing a model class specifically for service calls to my
I need to know the ID of the current user in a model: def
In my application I have View that observes Model changes. Controller is responsible for
My web application uses document.createEvent and event.initEvent to create custom events of the generic
I'm trying to use C# to control a command line application background, which can
I'm using Oracle to synchronize events between two nodes of my application server (never
When the view is initialized, how can I bind the model to the specific

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.