Alan Smithee

Greenhorn
+ Follow
since Mar 21, 2006
Merit badge: grant badges
For More
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 Alan Smithee

Originally posted by Jeanne Boyarsky:
Alan,
Some databases have a "materialized view." This is a view that stores/caches a copy of the query and is used when the query is expensive. Do you know if you have a materialized view or a regular view?



I doubt it is a materialized view because I run queries against the views and with unmodified data the performance is sluggish unless I re-execute the identical query right away. If I wait more than a few seconds, the query response is sluggish. However, I'll ask the DBA just to be sure.

Originally posted by Gopikrishna Madishetti:
In your case you may have many number of views created and that are accessed by the users a lot.



Yes. 100+ views each one mapping to a single table.


Originally posted by Chandra Bhatt:
The scenario is bit obscure to me. I doubt if that is anything
to do with using table for viewing the data or using the view.



It is a very odd set-up, but its the one I'm stuck with. OK, if the views are unlikely culprits, I'll start looking around elsewhere in the project.

Thank you all!
[ October 17, 2008: Message edited by: Alan Smithee ]
I'm trying to solve an issue where I'm working with a Sybase database and Sun's app server. For reasons that are beyond my control, the java application looks at updateable views that map 1:1 to the database tables. The views aren't used to combine data from multiple tables, each view simply contains the identical data found in every corresponding table.

I think, but I am not sure, that I have an abnormally large number of connections being used. All the connections are being closed properly, I'm just showing 60 thousand of them created in the past few weeks when we typically have 15 users on at most at any given time. I suspect that we are not using pooling properly, but I also want to know if pointing to the updateable views rather than to the tables directly has anything to do with that.

Thank you in advance.

Originally posted by Ben Souther:
That article is pretty old and out of date.

These days, something like that would be put in a plain old java object that is initialized and bound to scope from a contextListener.



Ah. I'll try to dig around for a better example then. Unless you know of something off hand?

Even still, static methods are not going to be able to access member variables. This is the case whether the class is a servlet or not.



That's something I should have known.


Thanks again!
17 years ago

Originally posted by Ben Souther:
Also, you're calling static methods from your servlet's class file from your tag. Why are you doing this?



Because I don't know any better and this code is being adapted from a JSP/JMS tutorial.

http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-jms.html

What I'm really trying to do is send a message from JSP to a JMS queue. This servlet misunderstanding is one symptom of my larger problem.

Anyway, thanks! I'll make the corrections and keep trying.
17 years ago
My jsp uses the tld to access this servlet:











Using weblogic9.0 as my container, I get an output of 0. I need it to be x. What am I doing wrong?
17 years ago
Yeah, I had initially assumed this was a Design Pattern I was not familiar with. Turns out I was wrong. This is just how they're referring to mapping error messages to objects. I'll post more if it turns out to be technically interesting, but as it stands right now I shouldn't have made the initial post and this thread can probably be deleted or locked.

Mea Culpa.
17 years ago
I'm not looking for someone to hold my hand. I'm looking for a link to a discussion or tutorial. I'm not even completely sure what one is. I'm guessing its a kind of lookup table to determine the best project-defined error for a given exception.

My google searches are turning up stuff on Python and Perl. Any guides for java?
17 years ago
Integer is not int

int is a primitive
Integer is an object

i2 is a reference to an Integer object containing the value of 125. i2 is not the value itself.

When you see the following:

Object variable = new Object();

remember that the variable is not the value. It's more like a remote control that points to the object.
That's one question that would take a week to answer.

Information can be found here:
http://www.theserverside.com/tt/articles/article.tss?l=SpringFramework

Spring reduces programming to stateless session beans and POJOs. The general idea is that Spring uses Inversion of Control mapping to decide what object and object properties are in use at runtime. The developer doesn't have to worry about things like what database he is using or what web policy is used.
I'm preparing a write up on Spring for my team and managers. I'm not asking for editing. I'm just trying to see if my own knowledge is adequate or if I need to go back to the books.


==============



Spring handles connections and exception handling for the developer. This removes a great deal of code out of the method so reading the code and troubleshooting is much easier. Spring can also perform domain object queries that maps the ResultSet to the object. When making a query, Spring locks the row during the transaction to help with data consistency. By default any runtime exception or thrown error will trigger a rollback.

Spring also examines the metadata of the connection and uses a DataAccessException and its various subs to produce more meaningful errors than provided by a SQLException (Hibernate uses these as well).

Spring uses a wrapper around the data source to act as a proxy. For smaller applications, the developer then uses the TransactionTemplate and/or PlatformTransactionManager to directly and programmatically manage the transactions. With larger applications, developers will use Spring�s declarative transaction management by using an @Transactional annotation to identify to Spring what class elements are transactional and what transaction attributes they have (e.g. read-only, timeouts). When the transaction is created, Spring checks for existing transaction before deciding to create a new one. Since creating connections is expensive and Spring does all the connection management, the improves the application performance.

Spring also employs Object/Relational Mapping (ORM) to allow queries to be performed on the java object and eliminating the need to know the database schema once it has been mapped. Spring�s ORM also provides caching that can be performed after each unit of work and at the SessionFactory to improve performance.
What I really don't like about some environments is they can tell you a compile went just fine when in fact it did not.

What can be happening is that your class files are still the old ones that were giving you the problem. So you may have recompiled, but are still using the older versions. This can be a real problem when there is NOT an error and you are trying to identify an issue with your code.

So -- assuming your issue will be corrected with a recompile -- I would suggest getting in there and deleting the class files. The JVM can't use a class that does not exist.
17 years ago

Originally posted by Velika Srbija:
How?



@SuppressWarning("all") public void foo() {
//your code here
}

You can get more specific than that if you like, but I'd read up on Annotations first. This feature was introduced in Java 5, so if you're using an earlier version, let me know.
17 years ago

Originally posted by pravanya Gullapudi:
i know that java.lang is an important package. why it is important?



All classes directly or indirectly extend java.lang because java.lang is where the Object class resides. Since all java objects are ... well ... objects you need java.lang to be able to reference java.lang.object.
17 years ago


2) How do you force garbage collection in Java ?



As mentioned above, you can't.

That being said...

Every object in Java inherits the finalize() method from java.lang.Object
This is the method that is called by the garbage collector when no reference variables to the object exist. However, it really isn't an order to clean the object up. It's more of a suggestion. By design, there is nothing you can do that will 100% clean unreferenced objects up.

I hope that helps.
17 years ago
Given the class
===================
public class AllStuff implements Serializable {

public List <IBigCar> bigcars;

}


And the following code
=======================

BigCar bc = new BigCar();
bc = (BigCar) this.classname.getAllStuff("uniqueID").getBigCarList().get(0);


This code compiles. Why am I not able to cast an interface from a list to an object?
17 years ago