Andy Grove

Greenhorn
+ Follow
since Nov 11, 2003
Merit badge: grant badges
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 Andy Grove

Here's a Spring/Hibernate tutorial that might be useful - it includes complete configuration files and code. It shows how to use control transactions (from the web tier in this example) and uses annotations on the DAO classes for Spring Transactions.

http://www.codesuccess.com/tutorials/spring_hibernate
There are many open source connection pool libraries that you can use rather than implementing your own connection pool. Apache DBCP is a popular one. You can use this in your code regardless of whether your code is deployed in a container or not.

Hope that helps.
Here's a tutorial on Spring JDBC Pagination that you might find useful.

http://www.codesuccess.com/tutorials/spring/pagination/
[ October 06, 2007: Message edited by: Andy Grove ]
How about storing the container as a member variable of your Inner class? Is this what you want to do?

public class Outer
{
class Inner {

protected Outer container;

public Inner(Outer container) {
this.container = container;
}

public boolean hasSameContainer(Inner i) {
return this.container == i.container;
}

}
}
16 years ago
Hi Monica,

mysql-connector-j is a jdbc driver. You need to read up on JDBC as the next step. I'd recommend taking a look at javadocs for DriverManager and Connection in the standard JDK.

Also, there's the JDBC tutorial here:

http://java.sun.com/docs/books/tutorial/jdbc/index.html

Cheers,

Originally posted by Golla Vensiri:
Hi

Can anyone help me out in storing a javaoject in Oracle database

Thanks in advace



I'd recommend taking a look at FireStorm/DAO as it can generate the code you need.

Cheers,
Oops! Hit the reply button too soon.

Cheers,

<a href="http://www.codefutures.com/weblog/andygrove">Andy Grove</a>
<a href="http://www.codefutures.com/products/firestorm">FireStorm</a>/<a href="http://www.codefutures.com/products/firestorm">DAO</a> 3.0 Generates Java code from relational schemas
The problem is that you are trying to bind a parameter to a LIKE clause. You cannot do this in JDBC. It is not parameterizable in the way that most other query criteria are.

You need to manually construct your SQL statement to include the department id

e.g.

query = "DELETE FROM departments_tbl WHERE department_id LIKE '" + departmentId + "'"

Hope that helps.

Cheers,
If you want to know the number of rows before processing them, you could always issue a "SELECT COUNT(*) FROM TABLE WHERE ...." SQL statement first.
I would recommend using FireStorm/DAO to generate DAO code from your database. That will give you simple Java classes for inserting/updating/deleting data.

Cheers,

Andy Grove
18 years ago
You can use service oriented facades very easily with the DAO design pattern. In fact, FireStorm/DAO can generate a service facade in front of your DAOs (which can be based on EJB, JDO, JDBC, Hibernate, etc.)

The service facades can easily be exposed as Session Beans, Web Services, and so on.
For example Data Access Object (DAO) code, including example code for exposing Data Access Objects as Stateless Session Beans, you can use FireStorm/DAO to generate full DAO code from your database.

There's also an FAQ entry on Data Access Objects and J2EE transactions:

http://www.codefutures.com/products/firestorm/faq/jdbc/transactions.html
I would definitely recommend using the DAO pattern in front of Hibernate.

Using DAO has several advantages:

  • Enforces good separation of business logic and data
  • Allows you to move persistence code from Hibernate in the future
  • Easier to expose DAO objects in SOA or Web Service environment


  • You might find this article on data access objects useful. It talks about using the DAO design pattern with an ORM approach.
    You can use FireStorm/DAO to design your database and generate both the tables and the Java code (and you can choose between JDBC, JDO, EJB, Hibernate implementations).
    I'm curious .. why was a code generator built in-house?

    If a commercial generator (<plug>such as FireStorm/DAOlt;/plug> ) was used there wouldn't be the need to tweak the generated code (although we do allow customers to tweak the code generator itself if they want to change the way that code is generated).

    Regards,

    Andy Grove
    CodeFutures
    [ February 25, 2005: Message edited by: Andy Grove ]