How to get jdbc peristent item

Motivation:
I’ want to get the minimum and the maximum of a temperature item from yesterdays persistent data.

Environment:

  • openhab 4.2
  • JavaScript Scripting
  • postgersql via jdbc

my Problem:
it seams I’m not abel to get proper access to persistance as the returned value are null.

this is th code so far…

rules.JSRule({
    name: "last Historic Item",
    description: "find last historic item",
    triggers: [triggers.TimeOfDayTrigger('00:00')],
    execute: (event) => {

        var begin = time.toZDT('00:00:00').minusDays(1);
        var end = time.toZDT('23:59:59');
        console.log("time from ", begin, " to ", end);

        var myItem = items.getItem("room_0a_temperature_1");
        console.log("my Item", myItem);

        var count = myItem.persistence.countBetween(begin, end, 'jdbc');
        console.log("count: ", (count !== null) ? count : "none found");
          
    },
    tags: ["Test", "historicItem"],
    id: "findLastHistoricItem"
  });
  
12:34:33.334 [INFO ] [n.script.file.findLastHistoricItem.js] - time from  2024-07-21T00:00+02:00[SYSTEM]  to  2024-07-22T23:59:59+02:00[SYSTEM]
12:34:33.337 [INFO ] [n.script.file.findLastHistoricItem.js] - my Item room_0a_temperature_1 (Type=NumberItem, State=19.5 °C, Label=UG Eingang Temperatur, Category=temperature, Tags=[Temperature, Measurement], Groups=[room_0a_shellydw2, room_0a_temperature])
12:34:33.341 [INFO ] [n.script.file.findLastHistoricItem.js] - count:  0

checking the database shows plenty of data