Java
Java
What is Java EE?
What's the difference between JPA and Hibernate?
Why does JPA have a @Transient annotation?
Describe the architecture you use for Java web applications?
Why spawning threads in Java EE container is discouraged?
requestDispatcher Interface Vs sendRedirect
requestDispatcher - forward() method
SendRediret
Which one is good?
What is Java Servlet?
Difference between an application server and a servlet container?
What is an EJB, and what does it do?
What is WEB-INF used for in a Java web application?
data access object (DAO) in java
What is the difference between Java RMI and JMS?
CLASSPATH, Java Buld Path (eclipse), and WEB-INF\LIB : what to use, when, and why?
Why is Java frequently used for enterprise applications?
What is the best practice for reading property files in Java EE?
Java Web Service framework/library, which is a better one and why?
What exactly is a container in J2EE and how does it help?
Difference between Java EE 7 and Java EE 6
Why do we use web.xml?
Difference between each instance of servlet and each thread of servlet in servlets?
Dynamic Web Module option in Eclipse
In Java, How do I make sure my web application is thread safe?
Is Java “pass-by-reference” or “pass-by-value”?
Differences between HashMap and Hashtable?
Read/convert an InputStream to a String
Iterate through a HashMap
Why is char[] preferred over String for passwords?
When to use LinkedList over ArrayList?
Generating random integers in a range with Java
How to test a class that has private methods, fields or inner classes
Converting String to int in Java?
How to avoid Java Code in JSP-Files?
In Java, how can I test if an Array contains a certain value?
“implements Runnable” vs. “extends Thread”
Does finally always execute in Java?
Static class in Java
Java inner class and static nested class
What issues should be considered when overriding equals and hashCode in Java?
What is reflection, and why is it useful?
- ------------------------------------------------------------------ --------
Java: checked vs unchecked exception explanation
Generalized steps for DB connectivity
1. Place the JDBC driver in the Java classpath
Typically JDBC drivers are in form of JAR(Java archival format : compressed bundle of pkged Java classes) :
Oracle supplies Type IV Thin Client type of the Driver : ojdbc14.jar/classes12.jar/ojdbc6.jar
How to add JDBC drvr's JAR to the classpath(w/o IDE)
set classpath=g:\oracle\jdbc\lib\ojdbc6.jar;
With IDE --- simply Add external Jar.
2. Load & register JDBC driver
2.1 Load the JDBC driver in JVM's memory.
API :
pkg : java.sql,oracle.jdbc.*
Class : DriverManager
DriverManager API :
2.2
public static void registerDriver(Driver instance) throws SQLException
eg : DriverManager.registerDriver(new OracleDriver());
OR
2.3
Class.forName("oracle.jdbc.OracleDriver");--- can raise ClassNotFoundExc
3. Get the fixed DB connection thro' the JDBC driver.
API : java.sql.DriverManager
public static Connection getConnection(String dbURL,String userName,String password) throws SQLException
Params : dbURL : URL to reach DB thro the drvr.
jdbc:oracle:thin:@HostDetails --- for oracle Type IV thin clnt driver
HostDetails = DBServerHost:1521:SID
eg : jdbc:oracle:thin:@localhost:1521:orcl
For lab pc --- jdbc:oracle:thin:@192.168.72.3:1521:orcl
4.Create the JDBC statement
Connection i/f method
public Statement createStatement() throws SQLException :
creates an empty JDBC stmt to hold the query & exec.
5. Fill in the query & execute the same.
Statement i/f method
If query is : select : u must use executeQuery method.If the query is DML other than select(i.e insert,delete,update) or DDL then use the method executeUpdate
5.1 For select query :(for result set returning query)
public ResultSet executeQuery(String sql) throws SQLException
Returns the result set consisting of selected rows & cols.
5.2 For others : (queries not returning RST)
public int executeUpdate(String sql) throws SQLException
Returns the updated row count : indicating how many rows were affected.
6.1 Process the ResultSet
API : ResultSet I/f method
-----------------------------------------------------------------------------
Whats The difference between # , % and $ signs in Struts Tags?
ServletContext Interface
asic Operators in EL:
Exact difference and relation between JSTL and Expression Language
Object persistence and Java
What is the use of filter and chain in servlet?
How to sort a Map on the values in Java?
StringBuilder and StringBuffer
Why does Java have transient variables?
How do servlets work? Instantiation, session variables and multithreading
ServletContext
HttpServletRequest and HttpServletResponse
HttpSession
In a nutshell
Threadsafety
What is a JavaBean exactly?
How can I generate an MD5 hash?
Difference between wait() and sleep()
what's a monitor?
Hibernate hbm2ddl.auto possible values and what they do?
Synchronization in Java
Why is Java Vector class considered obsolete or deprecated?
Why can't static methods be abstract in Java
Difference between HashMap, LinkedHashMap and TreeMap
Hashset vs Treeset
HashSet:
TreeSet:
Important points:
Why is the Java main method static?
The case against checked exceptions
Java: when to use static methods
Java: checked vs unchecked exception explanation
What is a Null Pointer Exception, and how do I fix it?
Design Patterns web based applications
Model View Controller pattern
Strategy pattern
Front Controller pattern (Mediator pattern)
Factory method pattern
Why doesn't Java allow overriding of static methods?
When should a class be Comparable and/or Comparator?
How to convert a Map to List in Java?
Prefer composition over inheritance?
Why use getters and setters?
Difference between a method and a function
What is the difference between an interface and abstract class?
Interfaces
Abstract classes
Polymorphism vs Overriding vs Overloading
difference between abstraction and encapsulation?
What's the point of OOP?
How do you design object oriented projects?
Aspect Oriented Programming vs. Object-Oriented Programming
Update
Why should I avoid multiple inheritance in C++?
Summary
1. Perhaps composition?
2. The Diamond of Dread
3. Interfaces
5. So, should I do Multiple Inheritance?
4. Do you really need Multiple Inheritance?
What is the difference between aggregation, composition and dependency?
Difference between FetchType LAZY and EAGER in Java persistence?
What are First and Second Level caching in Hibernate?
Hibernate SessionFactory vs. EntityManagerFactory
Hibernate: Difference between session.get and session.load
hibernate: LazyInitializationException: could not initialize proxy
What's the advantage of persist() vs save() in Hibernate?
What's the use of session.flush() in Hibernate
Can someone please explain mappedBy in hibernate?
What is the difference between Unidirectional and Bidirectional associations?
Difference between Spring MVC and Struts MVC
difference between Struts 1.x and Struts 2.x
Controller in Struts
struts.xml and struts-config.xml
Basic flow of Struts1
What Are the Benefits of Struts
Filters vs Interceptors in Struts 2
Why should I learn and use struts?
Struts 2 - Understanding the working between OGNL and params interceptor
Sessions in struts2 application
Login Example
Login Required
The Interceptor
The Configuration
What does a just-in-time (JIT) compiler do?
Powered by
GitBook
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
results matching "
"
No results matching "
"