I am writing Fluent NHibernate for an outdated Oracle database. The challenge is that tables have composite primary keys. If I were free, I would reconsider the relationship and automatically generate primary keys, but other applications should write to and read from one database, so I canβt do this.
These are the two tables that I will focus on:

Data examples
Trips table: 1, 10:00, 11:00 ... 1, 12:00, 15:00 ... 1, 16:00, 19:00 ... 2, 12:00, 13:00 ... 3, 9:00, 18:00 ... Faults table: 1, 13:00 ... 1, 23:00 ... 2, 12:30 ...
In this case, the vehicle 1 made three trips and has two errors. The first error occurred during the second trip, and the second error occurred when the car was resting. Vehicle 2 had one trip during which an error occurred.
Limitations
Rides of the same car never intersect. Thus, tables have an optional one-to-many relationship , because each error occurs either during the trip or not. If I wanted to join them in SQL, I would write:
select ... from Faults left outer join Trips on Faults.VehicleId = Trips.VehicleId and Faults.FaultTime between Trips.TripStartTime and Trips.TripEndTime
and then I would get a data set where each error appears exactly once (one-to-many, as I said).
Please note that there is no "Vehicles" table, and I do not need it. But I created a view that contains all VehicleIds from both tables, so I can use it as a connection table.
What am I really looking for?
The tables are huge because they span years of data, and each time I need only a few hours.
So, I need a comparison and criteria that will run something like the following SQL under:
select ... from Faults left outer join Trips on Faults.VehicleId = Trips.VehicleId and Faults.FaultTime between Trips.TripStartTime and Trips.TripEndTime where Faults.FaultTime between :p0 and :p1
Do you have any ideas on how to achieve it?
Note 1: At this time, the application should not be written to the database, so saving is not required, although if the mapping supports persistence, it may help at some point in the future.
Note 2: I know this is difficult, so if you give me a great answer, you will be rewarded properly :)
Thank you for reading this long question, and now I hope only for the best :)