Originally posted by suityou01
View Post
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Reply to: Any ORM (Hibernate) boffins about?
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "Any ORM (Hibernate) boffins about?"
Collapse
-
Originally posted by doodab View PostA class with a composite key will still give you one object per row. What you are calling someRows will be a collection or array of those objects.
What you could do is either have an instance object per row class and a Facade class to encapsulate the business logic of "get the latest row for this particular source id" or a source object and a row object with proper one to many relationship between "sources" and the rows in the table.
Leave a comment:
-
Originally posted by suityou01 View PostDid you follow the link I posted about composite keys? That is exactly what I want.Originally posted by suityou01 View Postclass somerows {
private someRow m_colRows();
somerows (flag loadLatestOnly, int source_Id) //If latest only then only load the latest row
{
//Build list of keys (source_id and load_date as composite key relating to the source_id argument) and instantiate an instance of someRow and stuff into the collection.
}
}
Then add a property to the class someRows to retrieve the someRow instances.
What you could do is either have an instance object per row class and a Facade class to encapsulate the business logic of "get the latest row for this particular source id" or a source object and a row object with proper one to many relationship between "sources" and the rows in the table.
Leave a comment:
-
Originally posted by eek View PostBecause wearing my awkward sod hat who is to say the following won't occur
Source_ID Load_Date Field_1 Field_2 Field_3
123 14/03/2010 09:00 ABC DEF GHI
123 14/03/2010 09:15 ABC DEF JKL
123 14/03/2010 09:15 ABC DEF MNO
and you no longer have a primary key to play about with.
The story is, user in source system updates or creates one record - trigger fires, insert happens.
The datetimestamp here could go to seconds or milliseconds if it pleases you
Leave a comment:
-
Source_ID Load_Date Field_1 Field_2 Field_3
123 14/03/2010 09:00 ABC DEF GHI
123 14/03/2010 09:15 ABC DEF JKL
123 14/03/2010 09:15 ABC DEF MNO
and you no longer have a primary key to play about with.
Leave a comment:
-
Originally posted by thunderlizard View PostI disagree at that point. With this data-first approach, the ORM class should represent the same as what 1 row in the database table does. Otherwise you're really going against the grain. The unique identifier for the class should be a <composite-id> of source ID and timestamp, like it is in the database.
If you want to group them by source ID, you're introducing business logic, not representing the database. Do that in code elsewhere.
Leave a comment:
-
Originally posted by doodab View PostNothing is wrong with using the PK as the unique identifier for a row, but you seem to want a class that represents multiple rows.
class somerows {
private someRow m_colRows();
somerows (flag loadLatestOnly, int source_Id) //If latest only then only load the latest row
{
//Build list of keys (source_id and load_date as composite key relating to the source_id argument) and instantiate an instance of someRow and stuff into the collection.
}
}
Then add a property to the class someRows to retrieve the someRow instances.Last edited by suityou01; 15 March 2011, 13:47.
Leave a comment:
-
So he needs to write one ORM class for Source_ID with a collection of ORM classes (as a property of the first class) to represent each row for that source_id ordered in descending date order.
If you want to group them by source ID, you're introducing business logic, not representing the database. Do that in code elsewhere.
Leave a comment:
-
Leave a comment:
-
Originally posted by eek View PostI think the problem he has is that he does not have a unique identifier to attach his Get request to. Give him an identity field or a sequence and send him on his way.
Then ignore the field when you do the real work.
LinkyLast edited by suityou01; 15 March 2011, 13:27.
Leave a comment:
-
I think the problem he has is that he does not have a unique identifier to attach his Get request to. Give him an identity field or a sequence and send him on his way.
Then ignore the field when you do the real work.
Leave a comment:
-
Any ORM (Hibernate) boffins about?
I am currently designing a data warehouse and have had the most bizarre conversation with the lead developer who says it is not possible to write an ORM class for one of my tables. (Don't ask why he is writing an ORM class for a data warehouse )
So the table accepts delta loads from a source system
PK Source_ID Int
PK Load_Date DateTime
Field_1
Field_2
So the primary key of the table is the source id from the source system, and the datetimestamp.
Easy enough.
How is it hard to write an ORM class to represent one row?
Take the following example
Source_ID Load_Date Field_1 Field_2 Field_3
123 14/03/2010 09:00 ABC DEF GHI
123 14/03/2010 09:15 ABC DEF JKL
So he needs to write one ORM class for Source_ID with a collection of ORM classes (as a property of the first class) to represent each row for that source_id ordered in descending date order.
He could even add a flag to the constructor to indicate a kind of "lazy load" of only the latest row.
Anyone spot a problem with this?Tags: None
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- A new hiring fraud hinges on a limited company, a passport and ‘Ade’ Today 09:21
- Is an unpaid umbrella company required to pay contractors? Yesterday 09:28
- The truth of umbrella company regulation is being misconstrued Nov 25 09:23
- Labour’s plan to regulate umbrella companies: a closer look Nov 21 09:24
- When HMRC misses an FTT deadline but still wins another CJRS case Nov 20 09:20
- How 15% employer NICs will sting the umbrella company market Nov 19 09:16
- Contracting Awards 2024 hails 19 firms as best of the best Nov 18 09:13
- How to answer at interview, ‘What’s your greatest weakness?’ Nov 14 09:59
- Business Asset Disposal Relief changes in April 2025: Q&A Nov 13 09:37
- How debt transfer rules will hit umbrella companies in 2026 Nov 12 09:28
Leave a comment: