I have big performance problem while inserting (updating) objects to database.
For brief I have objects: InstrumentHistory and History
I am going to insert big number of InstrumentHistory objects, using f.e.SessionBean.
1. Problem is, that InstrumentHistory object contains Instrument object that have high number of fields.
Code:
/**
* @hibernate.many-to-one column="instrumentId" class="com.finance.domainmodel.Instrument"
*/
public InstrumentStatic getInstrument() {
return instrument;
}
and
2. SessionBean receives from client object similar to InstrumentHistory, InstrumentHistoryDirect. This InstrumentHistoryDirect not contain Instrument object inside, but instead of that includes only instrumentId.
In result of 2. SessionBean in method implementing insert must search for object Instrument with instrumentId equals instrumentId that comes from InstrumentHistoryDirect. And than must construct InstrumentHistory object from InstrumentHistoryDirect instead of direct insert to InstrumentHistory table with instrumentId. And its bottleneck.
I will be happy for any help.
Note: reason for having InstrumentHistoryDirect object is f.e. import file where are stored only instrumentId values, or using other non-java clients, that are sending to backend only instrumentId, not whole Instrument object.