Cj Recto

Greenhorn
+ Follow
since Mar 02, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Cj Recto

Hi,

I'm trying to create a dynamic datatable using object[] instead of entity. So far, I was able to do it, but I can't find a way to filter the table.

Heres my xhtml code:



In a normal datatable that uses an entity, you just put the entity property in filterBy attribute. But since I'm not using an entity but an Object[], how can I filter the datatable?
What should I put on the filterBy attribute?

Thanks!
9 years ago
JSF
Ok, since you are beginning in java, you should start at the basic. If you want to learn web development, start by learning servlets and jsp, these are the foundation you need to understand in order to learn web development in java. Once you get a good grasp of it, then try using frameworks like spring and struts. But again the best way to start is to learn servlet and jsp.

I cannot suggest online tutorial, just google it, there's a lot of tutorial out there.

Hope it helps.
11 years ago
First of all, the way you approach session and transaction using HibernateUtil is kinda old school. Since you are using Spring framework, you should let spring handle the session and transaction using spring annotation.

To answer your question,
It is true that you can open session and transaction in any layer of your application, but since you are asking for the best place where to open session/transaction, then the answer is
hibernate sessions is best place in DAO layer, while hibernate Transactions is best place in the service layer.
uhmm I see... Thanks for helping :-)
I have another question regarding DAO and DTO, please correct me guys if my understanding is right. So we have tables which has a corresponding POJO classes, my questions is does those POJO classes equivaltent to DTO?

I understand that DAO will perform CRUD operations on the database. Please correct me if I am getting it right.

Thanks!
Thanks guys for taking time to answering my questions.

Sorry to offend you guys for cross posting. It's just that I'm on a project that needs to meet deadline. We have no senior programmer to ask and guide us regarding this matter. Especially when it comes to application design patterns. Most of our projects were developed without any pattern, "Just do it the way you want it". So I'm eager to learn from those expert people.

Again I apologize!
So you mean it's wrong to assume that a one DAO access only one table? I thought that one DAO access only one table as what I've seen on many examples. So if I have Student table, I would create a StudentDao which will perform all crud operations in student table. Hmm... I'm a bit lost here!

Can you site some examples.?

Thanks for your link, I'm currently reading it.
hellow guys, I'm currently on learning using Dao pattern in my project. So as what I know, one Table is equivalent to one DAO, am I right? just like StudentDao, SubjectDao. Each dao performs crud operations in their associated tables. But my question is , how am I going to create a DAO for joined tables? lets say I have a query to join student and subject table, then how do I create a DAO for that? Should I place it to the StudentDao? or to SubjectDao? or there's a good practice in that kind of situation?

TIA!
hellow guys, I'm currently on learning using Dao pattern in my project. So as what I know, one Table is equivalent to one DAO, am I right? just like StudentDao, SubjectDao. Each dao performs crud operations in their associated tables. But my question is , how am I going to create a DAO for joined tables? lets say I have a query to join student and subject table, then how do I create a DAO for that? Should I place it to the StudentDao? or to SubjectDao? or there's a good practice in that kind of situation?

TIA!
Hi guys, I'm currently on learning about Spring integration with Hibernate, and so far I'm getting it to work. But I've run into situation where I dont want to commit the transaction at the end of process because I just want to see the generated sql stattement for testing and debugging purposes.

I have already added <prop key="hibernate.connection.autocommit">false</prop> to my hibernate properties, but then It still doesn't working.

Is it possible to achieve if using Spring to handle hibernate transaction? because in using traditional transaction in hibernate , it is possible, just don't call the session.commit() method and all the updates and insert will not be saved;


currently I have this code for service layer :




code for Dao layer :


But what happens here is that it does commit the transaction!, But I dont want to commit the transaction just for testing and debugging purposes.


I've also tried
@Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
instead of
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
But what happens here is that it does not commit the transaction, however the count of employee does not also incrementing.
So, what I am expecting to happen here is that count the number of employee before inserting to employee table. Then insert to employee table and count again the number of employee, so it would increment by 1. But at the end of the process , I don't want to commit that insert!

Do you have any Idea guys?

I would be very thankful for any help!
Thanks!



11 years ago
I've been having a problem regarding, I have a form which has a lot of fields , and each fields retrieves a data depending on the associated button that was clicked.

So, each my button, needs to call an ajax request, then the response will be displayed on the associated field.

I wonder if it is possible to call different method in my spring controller once i clicked on different button?

In other words, I want to make a multiple ajax request, and each request will call different method.

for example this code :


Currently what I can do, is to have one ajax request only.


Please , if anyone could help me on this.I really need this functionality and would greatly appreciate your feedback.
11 years ago
Thanks pamir sonmez, it helped! ;-)
11 years ago
Hellow guys, Do you have any Idea how to display loading gif image while processing data on web page?
I'm currently retrieving thousands of records from a server then load it to a table. I just want to display a loading gif
during the process.

here is the code of my view :
this will load thousands of rows coming from the server.



Any Idea would be appreciated guys!

Thanks in Advance!!! :-)
11 years ago
I thinks I found the solution, let me post it here just incase anyone would experience the same problem.

in your mvc resources configuration, set cache-period="0" so it will prevent resources files from being cached.

I found it here:

prevent spring mvc resources from being cached

11 years ago