What's the standard solution to this...
I have two classes. "User" and "DatabaseManager". Users have a user name and password, and lots of other fields. I want to be able to get a User object constructed, with all its fields filled from a database, supplying the user name and password alone. However, only the DatabaseManager can access the database. Also, there are other things in the package that don't need direct access to User's fields.
In c++, I would use the 'friend' keyword, allowing DatabaseManager and noone else access to the fields. In java, I can't.
So, how do I do that in an elegant fashion?
If I make a User (String name, String password) constructor, I'll have to add twenty new methods to DatabaseManager to retrieve each field.
If I make a User getUser (String name, String password) method inside DatabaseManager, I'll have to add twenty new methods to User to allow DatabaseManager to write each field.
Or, I can make each of User's fields package-protected, thus allowing DatabaseManager to access them.
I really dislike the idea of adding a heap of methods to either of the classes just to solve this problem. And in all cases, everyone in the package gets access, not only the classes that need it. I'm leaning towards the last solution, but I'll seek advice from the experienced ;)
What is considered "good programming" in these cases?
If I have this right, your approach seems to be the wrong way round in that you expect the DatabaseManager to populate the User object. Another approach is:
1. Application code invokes a static method in the User object called something like "findUser" that takes the username and password as parameters.
2. The User object invokes database read methods via the DatabaseManager that return either a resultset or a Collection. The User object then populates its own attributes from the Collection.
3. The User object returns a new instance, or null if not found.
You may also want to search for the "DAO design pattern" which addresses this issue in detail.
Similar Messages
-
What are the standard Solutions available for Complaints Management in CRM?
Dear all,
What are the standard solutions available in SAP CRM to receive and process complaints through Customer Interaction Center.
Our requirement is to receive and register complaints from contact center and process them by integrating back end ECC and BIW systems.
As per my understanding we can not integrate ECC transactions in CASE Management while CASES are being created through Interaction Center.
Please help me to map the following requirement successfully into SAP.
How to register the complaint through Interaction Center?
How this complaint information is communicated in back end ECC system?
How to track the status and solution of the complaint available in back end ECC system?
How the complaints are stored in ECC system?
After creation of a complaint, can we trigger an automatic email on back end ECC system user with all complaint relevant data?
Kindly help me to understand the process.
Best regards,
Raghu ram.You can analyse this [link |http://help.sap.com/saphelp_crm60/helpdata/en/68/691976cd2ef845a4e62437a82b67df/frameset.htm]for more information. Additionaly the tree hierarchy links contain some process flows where it explains you briefly the big picture of the process, in standard SAP CRM Complaint Manaagement Scenario.
BR,
Cenk Sezgin -
Help Me.
What is the best solution for this problem ?Encore is activated when you activate Premiere Pro... so, as Stan asked, how did you install P-Pro?
Ask for serial number http://forums.adobe.com/thread/1234635 has a FAQ link
-and a fix for Encore http://forums.adobe.com/thread/1421765?tstart=0 in reply #7
-plus more Encore http://helpx.adobe.com/encore/kb/cant-write-image-fie-larger1.html -
Migrated Aperture 3 upgrade from old Mac Book Pro to new Mac Book Pro. Can't open Aperture on new machine because I don't have the original serial number for Aperture 2 program originally installed on the old machine. What is the best solution to this situation
Call Apple and make a appointment.
You have 3 months of care and up to 3 years with paid AppleCare, let them handle it and bring everything in.
Good Luck -
The charger port pin in an iphone 5 is broken. What are the possible solutions to this issue?
Read: http://support.apple.com/kb/TS4436
It is pretty short so here is the entire text:
Symptoms
A purplish or other colored flare, haze, or spot is imaged from out-of-scene bright light sources during still image or video capture.
Resolution
Most small cameras, including those in every generation of iPhone, may exhibit some form of flare at the edge of the frame when capturing an image with out-of-scene light sources. This can happen when a light source is positioned at an angle (usually just outside the field of view) so that it causes a reflection off the surfaces inside the camera module and onto the camera sensor. Moving the camera slightly to change the position at which the bright light is entering the lens, or shielding the lens with your hand, should minimize or eliminate the effect.
Which is exactly what eelw wrote.
No one on Apple Support Communities has authority to speak on behalf of Apple, unless their avatar is accompanied by this Apple image:
... identifying themselves as Apple employees. -
What is the best solution to this problem?
I have so many solutions in mind right now but i am looking for the best solution if possible. i have the following query
SELECT one_query.date_required as Month_id,
nvl(one_query.amount_used, 0) as overalluserhours_A,
nvl(second_query.amount_used_b, 0) as overalluserhours_B,
nvl((trunc(((second_query.amount_used_b/one_query.amount_used) * 100), 2)), 0) as p_change
from
(select to_char(b1.needed_date,'YYYY-MM') as date_required,
SUM(b1.amount_used) as amount_used,
b1.type_id as type_id
from table_one b1
where b1.zone_type like 'NEWYORK%'
and b1.type_id = 'CARS'
and trunc(b1.needed_date) between to_date('2009-01-01', 'YYYY-MM-DD') and to_date('2009-12-31', 'YYYY-MM-DD')
group by to_char(b1.needed_date,'YYYY-MM'), b1.type_id) one_query,
(select to_char(b2.needed_date, 'YYYY-MM') as date_required,
SUM(b2.amount_used) as amount_used_b,
b2.type_id as type_id
from table_one b2
where b2.zone_type like
'CHICAGO%'
and b2.type_id = 'BIKES'
and trunc(b2.needed_date) between to_date('2009-01-01', 'YYYY-MM-DD') and to_date('2009-12-31', 'YYYY-MM-DD')
group by to_char(b2.needed_date, 'YYYY-MM'), b2.type_id)second_query
where one_query.date_required = second_query.date_required(+);the above query is being used on table_one. The current problem I am having is based on the fact that table_one might sometimes contain data for only chicago and not for newyork. in this case, table_one would look like this
identification_id needed_date zone_type type_id
2 3/22/2006 12:00:00 CHICAGO BIKES
3 2/12/2006 12:00:00 CHICAGO BIKEShowever though, in other case, it could be the other way around. in this case, table_one will look like this
identification_id needed_date zone_type type_id
4 4/21/2007 12:00:00 NEWYORK CARS
5 1/12/2007 12:00:00 NEWYORK CARS
and finally table_one could contain information for both cases. hence, we could have the following situation
identification_id needed_date zone_type type_id
6 6/21/2008 12:00:00 NEWYORK BIKES
7 8/12/2008 12:00:00 CHICAGO CARSKindly note, my above query is currently being used inside a function. I know I can write so many if statement to handle but the main issue is regarding the fact, i am also using that query in another query which performs so many union all.I'm not sure how you're going to parameterize it, how those filters change from call to call, but an idea would be something like this:
select date_required month_id,
max(amt_used_chicago_bikes) overalluserhours_A,
max(amt_used_newyork_cars) overalluserhours_B,
(max(amt_used_chicago_bikes) / max(amt_used_newyork_cars)) * 100 p_change
from (select zone_type,
to_char(b1.needed_date, 'YYYY-MM') as date_required,
b1.type_id as type_id,
SUM(case when zone_type like 'CHICAGO%' and type_id = 'BIKES'
then b1.amount_used end) as amt_used_chicago_bikes,
SUM(case when zone_type like 'NEWYORK%' and type_id = 'CARS'
then b1.amount_used end) as amt_used_newyork_cars
from table_one b1
where trunc(b1.needed_date) between
to_date('2009-01-01', 'YYYY-MM-DD') and
to_date('2009-12-31', 'YYYY-MM-DD')
group by b1.zone_type,
to_char(b1.needed_date, 'YYYY-MM'),
b1.type_id)
where amt_used_chicago_bikes is not null or amt_used_newyork_cars is not null
group by date_required;Again, this is not the biggest concern regarding performance and certainly not the best way of doing it. Cracking those 250 lines of SQL and making it optimized would probably be the best way to approach the issue here. -
Coalesce or compress this index? what is the best solution in this case?
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64biI have executed the following query on a specific index that I suspected to be smashed and got the following result
select
keys_per_leaf, count(*) blocks
from (
select sys_op_lbid (154813, 'L', jus.rowid) block_id,
count (*) keys_per_leaf
from xxx_table jus
where jus.id is not null
or jus.dat is not null
group by sys_op_lbid (154813, 'L', jus.rowid)
group by keys_per_leaf
order by keys_per_leaf;
keys_per_leaf blocks
1 80
2 1108
3 2816
4 3444
5 3512
6 2891
7 2579
8 2154
9 1943
10 1287
11 1222
12 1011
13 822
14 711
15 544
16 508
17 414
18 455
19 425
20 417
21 338
22 337
23 327
24 288
25 267
26 295
27 281
28 266
29 249
30 255
31 237
32 259
33 257
34 232
35 211
36 209
37 204
38 216
39 189
40 194
41 187
42 200
43 183
44 167
45 186
46 179
47 179
48 179
49 171
50 164
51 174
52 157
53 181
54 192
55 178
56 162
57 155
58 160
59 153
60 151
61 133
62 177
63 156
64 167
65 162
66 171
67 154
68 162
69 163
70 153
71 189
72 166
73 164
74 142
75 177
76 148
77 161
78 164
79 133
80 158
81 176
82 189
83 347
84 369
85 239
86 239
87 224
88 227
89 214
90 190
91 230
92 229
93 377
94 276
95 196
96 218
97 217
98 227
99 230
100 251
101 266
102 298
103 276
104 288
105 638
106 1134
107 1152
229 1
230 1 This is a 5 columns unique key index on (id number, dat date, id2 number, dat2 date type number).
Furthermore, a space analysis of this index using dbms_space.space_usage gives the following picture
Number of blocks with at least 0 to 25% free space = 0 -------> total bytes = 0
Number of blocks with at least 25-50% free space = 75 -------> total bytes = ,5859375
Number of Blocks with with at least 50 to 75% free space = 0 -------> Total Bytes = 0
number of blocks with at least 75 to 100% free space = 0 -------> total bytes = 0
Number of full blocks with no free space = 99848 -------> total bytes = 780,0625
Total blocks ______________________________
99923
Total size MB______________________________
799,384It seems for me that this index needs to be either coalesced or compressed.
Then, what would be the best option in your opinion?
Thanks in advance
Mohamed Houri
Edited by: Mohamed Houri on 12-janv.-2011 1:18So let me continue my case
I first compressed the index as follows
alter index my_index rebuild compress 2;which immediately presents two new situations
(a) index space
Number of blocks with at least 0 to 25% free space = 0 -------> total bytes = 0
Number of blocks with at least 25-50% free space = 40 -------> total bytes =, 3125
Number of Blocks with at least 50 to 75% free space = 0 -------> total Bytes = 0
Number of blocks with at least 75 to 100% free space = 0 -------> total bytes = 0
Number of full blocks with no free space = 32361 -------> total bytes = 252, 8203125
Total blocks ______________________________
32401
Total size Mb______________________________
259,208meaning that the compress command freed up 67487 leaf blocks and reduced the size of the index from to 799,384 MB to 259,208 MB.
It also shows a relative nice pictue of number of keys per leaf block (when compared to the previous situation)
(b) on the number of key per leaf block
KEYS_PER_LEAF BLOCKS
4 1
6 1
13 1
15 1
25 1
62 1
63 1
88 1
97 1
122 1
123 3
124 6
125 4
126 2
289 4489
290 3887
291 3129
292 2273
293 1528
294 913
295 442
296 152
297 50
298 7
299 1 In a second step, I have coalesced the index as follows
alter index my_index coalesce;which produces the new figure
Number of blocks with at least 0 to 25% free space = 0 -------> total bytes = 0
Number of blocks with at least 25-50% free space = 298 -------> total bytes = 2,328125
Number of Blocks with at least 50 to 75% free space = 0 -------> Total Bytes = 0
Number of blocks with at least 75 to 100% free space = 0 -------> total bytes = 0
Number of full blocks with no free space = 32375 -------> total bytes = 252, 9296875
Total blocks ______________________________
32673
Total size MB______________________________
261,384meaning the the coalesce command has made
(a) 298-40 = 258 new blocks with 25-50% of free space
(b) 32375-32361 = 14 new additional blocks which have been made full
(c) The size of the index increased by 2,176MB (261,384-259,208)
While the number of key per leaf block keeps in the same situation
KEYS_PER_LEAF BLOCKS
4 2
5 3
9 1
10 2
12 1
13 1
19 1
31 1
37 1
61 1
63 1
73 1
85 1
88 1
122 1
123 4
124 4
125 3
126 1
289 4492
290 3887
291 3125
292 2273
293 1525
294 913
295 441
296 152
297 50
298 7
299 1 Could you please through some light on the difference between the compress and the coalesce on the effect they have made on
(a) the number of keys per leaf blocks within my index
(b) the space and size of my index?
Best regards
Mohamed Houri -
[Sales/Shipment report] - What's the best solution?
Hello everybody.
I have to develop a report with some sales data, delivery service data and shipment costs data.
I have the cubes: 0SD_C03, 0SD_C04, 0LES_C02.. and I thought to do a multicube, but I don't no how to link these cubes...
I don't have, for example, Sales Document/Item and/or Delivery Document/Item in all os these cubes...
What is the best solution to this sittuation?
I thought in some solutions like...
1 - Extend extractor of 0LES_C02 to include Sales Doc/Item, but I don't know if all delivery doc is related to a sales doc.
2 - I know I have all the fields that I want in the tables VBAP and LIPS...so I thought in create an generic extractor with a view of these two tables, and than creat a Z cube, to receive these datas...
I really don't know whats the best solution, or if there is abother solution to this....
I'll apreciate ideas, or a solution from someone that already face with this and developed a solution.
Best Regards,
ThiagoHi,
Its better for you to add sales order,item in the cubes also from the source where your cube gets data ie from DSO as they are only point through which you can combine sales,delivery and billing data.
Thanks,
Arun -
What are the possible solutions..?
I have a column in a database table of type LONG RAW . This column was represented as an OLE Container - which in 10g is obsolete - in a form (Forms 6i). Trying to compile this form to Forms10g , I receive an error FRM-30454.
Is it possible to retain the form as it is , by simply change a property , ....
Anyway , What are the possible solutions for this kind of problem?
Thanks , SimonNice subject title. It is as good as "Urgent. Please help". Why don't you go back and edit your message and change the subject to something like:
Long Raw / OLE: 6i to 10g -
I have installed HP2035n. But when i try to open the embedded web server, i get the error "Firefox doesn't know how to open this address, because the protocol (fe80) isn't associated with any program." What is the possible solution?
I typed in the IPv6 address of the printer in the address feild of firefox.Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode
Do a malware check with some malware scanning programs.<br />
You need to scan with all programs because each program detects different malware.<br />
Make sure that you update each program to get the latest version of their databases before doing a scan.<br />
* http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
* http://www.superantispyware.com/ - SuperAntispyware
* http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
* http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
* http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
See also:
* "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked -
I have iphone 5, after upgrading it to iOS7, front is working find unfortunately rear camera became blurred, what is the best way to fix this? Looking forward to the best solution of this problem.
WORKAROUND FOUND ! Download and install "Awesome Camera" app and take a picture with that app. After 1-2 seconds of standby, it will work. Then you can go back to default Camera app which would work again.Please let me know
-
What is the DYI solution to error "contact iTunes support to complete this transaction"
What is the DYI solution to error "contact iTunes support to complete this transaction". They have fixed it for me before but it still happens every so often and I would love a DYI fix since its on going! And please no answers that are 'contact iTunes support to fix this error' as I know that but you have to wait a minimum 24hrs and the problem is reoccurring.
Seriously, the DIY solution is to contact supprt. There is nothing you can do to magicaly fix this and we can;t help you fix it because we are all just users like you. Contact support.
-
Many times my computer takes too long to connect to new website. I have wireless internet (time capsule) and I am running a pretty powerful real time financial work program at same time, what is the best solution? Upgrading speed from cable network? is it a hard drive issue? do I only need to "clean out" the computer? Or all of the above...not to computer saavy. It is a Macbook Pro osx 10.6.8 (late 2010).
Almost certainly none of the above! Try each of the following in this order:
Select 'Reset Safari' from the Safari menu.
Close down Safari; move <home>/Library/Caches/com.apple.Safari/Cache.db to the trash; restart Safari.
Change the DNS servers in your network settings to use the OpenDNS servers: 208.67.222.222 and 208.67.220.220
Turn off DNS pre-fetching by entering the following command in Terminal and restarting Safari:
defaults write com.apple.safari WebKitDNSPrefetchingEnabled -boolean false -
I have three iPhone 4 models purchased in late 2010 (for my family) that all share the same iTunes account for access to apps and music, but each phone/user still has his/her custom contact list, email accts, and select lists of apps and music from the one iTunes acct library. The problem is I can only update the software on one of the three iPhones – the primary phone I used to setup the iTunes acct. What is the best solution to manage these devices for software updates, apps? This is probably a common problem with families wanting to share apps and music without realizing the issues created by this approach. As it stands today... the first (primary) iPhone associated with the iTune acct has been updated with the latest software version 5.1.1 and sync'd up with all the apps, music, etc from the one iTune acct, while the other two iPhones are still running on the original software version 4.0.2 and are experiencing problems now. I was advised by AT&T back in January that it would be necessary to setup separate iTunes accts for the second and third iPhones in order to receive system updates. The problem would be how to keep all the apps, etc from being deleted off the second and third phones that were originally loaded from the one iTunes acct. Since this AT&T advice was prior to iCloud coming out, would iCloud be a better solution or at least part of the solution? I really don't yet understand how iCloud works. Hopefully, someone out there can help me?? Please?
I have three iPhone 4 models purchased in late 2010 (for my family) that all share the same iTunes account for access to apps and music, but each phone/user still has his/her custom contact list, email accts, and select lists of apps and music from the one iTunes acct library. The problem is I can only update the software on one of the three iPhones – the primary phone I used to setup the iTunes acct. What is the best solution to manage these devices for software updates, apps? This is probably a common problem with families wanting to share apps and music without realizing the issues created by this approach. As it stands today... the first (primary) iPhone associated with the iTune acct has been updated with the latest software version 5.1.1 and sync'd up with all the apps, music, etc from the one iTune acct, while the other two iPhones are still running on the original software version 4.0.2 and are experiencing problems now. I was advised by AT&T back in January that it would be necessary to setup separate iTunes accts for the second and third iPhones in order to receive system updates. The problem would be how to keep all the apps, etc from being deleted off the second and third phones that were originally loaded from the one iTunes acct. Since this AT&T advice was prior to iCloud coming out, would iCloud be a better solution or at least part of the solution? I really don't yet understand how iCloud works. Hopefully, someone out there can help me?? Please?
-
What is the STANDARD Web Template in BI 7.0?
Hello guys,
Do you know what is the Standard Web Template in BI 7.0?
Today we only use Workbooks and the java is already installed.
Do we have to do some configuration in this Web template for our first execution?
Thank you,
Carlos EdaurdoHi,
0ANALYSIS_PATTERN is the standard Web template for the BI Queries when executed through Web.
We can copy this template to a Ztemplate and make the changes necessory based on project need and can be assigned
as default in Configuration settings .
Thanks,
Prakash
Maybe you are looking for
-
This version of iMovie cannot import Trailers created in iMovie for iOS.
I have the latest verison of iMovie on both my Mac and iPad 3g. I used a trailer on the iPad iMovie and exported it to iTunes. On my Mac I went to iTunes and pulled the file down and clicked to open it. After iMovie can up it dispalyed "This version
-
At what point is "other" in storage considered excessive?
Right now my other category is taking up 2.67gb of my 13.37gb of available storage. I still have plenty of room left at 4.92 gb free, but was just wondering if this calls for a restore as I am not sure how much of the data in this category would beco
-
Hi In VK11 code, while entering a price I like to have two level of authorisation, a. Sales person will enter a price b. Finance person will approve it. After approval only VK11 price should be activated for sales price calculation. How do I config
-
RC_RMAN_BACKUP_JOB_DETAILS
Hi, Assume i am using oracle 10.2.0.4 database and have recovery catalog. My database is registered in Recovery catalog. 1) Can i assume that every backup operation on my database would be registered in recovery catalog's RC_RMAN_BACKUP_JOB_DETAILS v
-
Installing with Oracle or MS-SQL
Hello, Is there a PDF or some page with the necessary setup to install LiveCycle ES Reader Extensions with Oracle and MS-SQL Server? Thank you for any info. Marcos