Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Alfred Kemety

Ranch Hand
+ Follow
since Aug 14, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alfred Kemety

with SQL query I would make a view that joins both tables and

SELECT dealer,MAX(car) WHERE ........ GROUP BY dealer, not sure how would this map to your case...
In a conversation about mapping data to objects, I was presenting the problem of displaying data saved in a database that I have. Once we start talking about retrieving data from a complex database schema, logical basic entities can't really hold the data in a good format.

To explain myself, I'll take the most common example.
Tables:
customer, order, order_details, product, vendor.
Classes:
Customer, Order, Product, Vendor.

Customer has a collection of Orders, Order has a collection of Products, Product has a Vendor Object and a Country Object (or just a string . Very simple basic and nice.

Now I want to display a list of product names and their vendors names for a certain customer. In the Database, it's simple, I'll create a view that inner joins customer to order, order to order_details, order_details to product, product to vendor, SELECT the names and uniqe identifiers and life is easy.

Now in the data tier I connect (JDBC) get a JdbcRowSetXImpl, and........ hmmmm now I don't want to send to the interface a typless result set to display, I want to put the data into a business entity that I can simply bind to a JSF data table. None of the business entities is suitable to create an object collection from and pass it to the interface...

One suggestion was to create a business entity to every view that I have in the DB, it's a big investement in the begining to make such a factory but then once done, adding to it is not going to be difficult. Also there are some software that would generate the entities automatically.

Is this a good approach? What's a better approach. Note that I want to be able to simply and directly bind the collection of entities to the data table directly to display it.

Thanks in advance for your input,
Alfred
Dear all,
I am designing an application with a multi-tier architecture. The problem that I face is to find the best way to implement the Data Access Layer. The main problem that I face is where should my SQL statements reside?

Two options are:
1- Stored Procedures:
All insert, update, delete and even the select statements should be written in a parametrized stored procedures and I have methods that call the stored procedure, pass the parameters and get the data.
In my opinion, this separates SQL code from Java code, which is something I like. On the other hand if I would change the DB from Oracle to SQL or to mySql then I would have problems with the Data Layer Implementation.

2- Within Java Code:
All sql statements are hard coded in the java classes. Then I can write standered sql statements and so the layer would be able to access any DB just by changing the provider. On the other hand, even the select statements are hard coded and so any simple change would need recompile, also performance will be less than the case of Stored Procedures.

What do you think is the best solution? Also if you have any reference regarding best practicies in building the Data Access Layer, please let me know.

TIA
Hello all, I work currently for a Univ. in Cairo and we would like to redistribute the J2SE SDK software to the students and have it hosted on our server so that the students can download it faster and copy it to their flash memory etc...
What is the policy of Sun in this regard? Any links would be appreciated.
Thanks in advance,
16 years ago
Yes Kris, you can try it with the code as well.
Well it should actually work with the first code, even with the new operator inside the loop.
This raises the question about how "random" random numbers generated by the JVM are :roll:
Taurean,
The compilor can evaluate some statments during compile time. These statements include the ones that uses only literals or final variables.
Thus if(true) is evaluated, so the compilor knows that the next statment will SURE be executed during runtime and thus it won't signal an error that i might not be initialized.
Same goes for if(1==1) as 1 and 1 are literals thus evaluated during compile time.
The last if statement can't be evaluated at compile time for the fact that j is neither a literal nor a final variable.
Hint: Try changing the first if statement to if(false) and compile.
What will be the result?
The point of public and non-public here is not the Exception throwing, but rather the availability of the method to other classes and objects.
I'm a SCJP 1.4 and I would like to ask if this is enough to start working on SCBCD or not?
Is the knowledge of SCWCD required?
Also what can you do after learning SCBCD if you don't develop servlets and JSPs?
Is the SCBCD related in any way to the new "struts" hype.
Ok, I know I am asking a lot of naive and maybe silly questions but I come from the realm of .NET
I agree with you both... no one know when will this object be illigible for GC... One can say for sure though that the array object oa created at line 2 is illigible for GC after exiting the method...

Originally posted by janne kallio:
Hi!
Wondering about the following code.
int s[];
s=new int[3];
s[0]=new int[2];
Why does this cause compile error?
j


To make things clear here... int s[] declares an array with elements of type int.
So s[0] is of type "int" now in the step:
s[0] = new int[2]
you creat an object - Array - using the new operator and assign you try to assign the Array object to a variable of type int... clearly illegal operation and that's why you get a compile error.
Derek, Arrays are immutable objects, yet their elements are normal variables of any type that can have their values changed. As you can not change the length of a string, you can not change the length of an array.
So there are no equivelant features???
Thanks for the advice, but can you please tell me how would the code look like? Just a little snippet of code.
17 years ago
JSP
I have been trying to decide for a while which tech. I should learn.
Of course J2EE seems to have the market, yet I have through the .NET platform and the first few things I learnt got me really impressed.
My expreince in web dev. is with asp not jsp, I assume jsp methodology is not so different, but I don't know...
So I'm trying to find out if you J2EE gurus know the equivelant features in the J2EE realm, if it exists. I will list them and please tell me:
First: no more html/jsp or html/asp code spaghetti, you write your html code in a page and all the other business in the codebehind file.
Second: server controls like <asp:textbox> etc. these controls can easily be manipulated, they retain their values during roundups.
Third: the _VIEWSTATUS feature which keeps all the information of the forms.
Fourth: The validation controls are excellent and only adds 1 line of code to do client side & server side validations, there are some that are ready made and you can add new ones.
Also writting beans like components are no different from writting any class.
So can anyone give me hints? Point me to equivilants to these simple, surface features that are yet very helpful and helps in development acceleration?
One more thing, the VS is excellent development tool, what would be the equivilant in the J2EE?
I am an SCJP and I LOVE Java, and I really want to go for the J2EE, but the way .NET makes it easy to develop web apps really graps my leg, so help me guys get back to J2EE...
Thanks in advance,