I have a class that have 4 one-to-one propeties. Is possible to EagerFetch them? I want to display a list of the class, but it takes an eternity.
I know that there is no EagerFetch for ManyValuedAssociations , but this is a one-to-one relationship, so I know there will be max 1 row for each property.
If you look at the Aurelius manual section under Association, you will see that Eager loading is the default mode unless Lazy is specifically asked for.
Regarding many values associations, that link you provided is from 2016 - an old version of Aurelius. Current versions do support both Eager and Lazy, with Eager again being the default.
Also, in one-to-one relationship, there is always a side that is an Association (instead of Many-Valued Association). You can simply query from that side and then data from both tables will be retrieved in a single SQL statement.
First - thank you both for helping. I attach the class definitions, because I'm a little confused. Also Wagner's suggestion - how to do it, because there are 4 one-to-one relations?
In this specific case there is indeed not much to do.
But your one-to-one relationship is strange. First, it's not one-to-one because you don't have unique keys in your detail classes mapping. Maybe you have created manually in the database, I don't know.
Have you considered adding the FK references to the TStockItem? In other words, create Association (not Many-Valued Association)?
I have a question - how would you link the classes if the database is like this (see below)?
I tought it's a one-to-one relationship and indeed it work, but viewing the products is very slow.
It's also nice that saving the TStockItem automatically saves all the subclasses (stock, dim, prices..).
If it's slow I imagine you are retrieving thousands of products. In this specific case, I would create a database view that consolidate the products and their 1-1 additional info (stock, prices) and then create an Aurelius class mapped to that view to retrieve all data at once.