Peter Primrose

Ranch Hand
+ Follow
since Sep 10, 2004
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 Peter Primrose

Say an end-user made a payment and I wish to send him an invoice (or a reference for the payment). So s/he completes a form and clicks submit.

My question is this: given the action below - is this something that makes sense from MVC perspective? Is there a tight coupling between the action and the business logic? Am I missing the point of sturts' actions? how would you do it differently.

Thank you James

My question is with reference to the concept not the compilation (for this I have eclipse )

Does the action make sense to you in terms of BUSINESS OBJECT construction?

Thank you James for your observation


When programming with Struts, you should avoid writing business logic code in the Action class. This includes any operations that "save" data in a database.



True, I read (and I think it was you) that a good indication of 'the right way to write the actions' are with junit. If it's hard to test the action - then something is wrong with the way you design it.

Ok...technical question:

Could you please comment my actions above, is this the right way to write them? Do I maintain MVC to the level of 'large-system'

Thank you and hope to learn something new!


Hi all,

So far in my struts action I used to persist my pojo with DAO eg:



Recently I've been introduce to Hibernate and I saw this usage:



My question is this: given the syntax of hibernate, is there any reason continuing using DAO to persist the data? I mean why bother building DAOs if hibernate provide this syntax to persist your data?

Why developer would choose using DAO if they are using Hibernate?

Thanks for any thoughts
Thanks for the source correction; I should have post it before (I learned something)

As per my question, you're saying that Hibernate cannot do it (auto-generate the ERD from the annotated pojos), so do you know any plugin that can do that?

When I used iBatis, it had 'abator' that connected to the DB and generated all the pojos/daos; I wonder what is the equivalent in Hibernate.

Also (hope I'm not asking too much) I like to create the pojo myself with annotations (so I know what's going on in terms of composition, foreign keys etc) and create the db & ERD (auto-generated).

Thanks for any help!


I just tackled this notation - schema

example


I wonder what does it mean and (not sure it relates...but) how is it possible to auto-generate a schema of classes from the domains?

example



Thank you!
Say I have a list of items and each item has a link (URL)

example:


Question: What will be the best way to secure this action (editAccount) if the user is not authorized to access this account (ID 74881) -- (obviously, the user can change the URL and type the ID there)

One thing came to mind is to use an interceptor - and check if the user has permission to access this account.

So if interceptor is the right solution, how would one design it?
there could be other 'resources' eg: account, user, department, request etc.

Thanks for any thoughts
9 years ago
Hi all,

we are about to start a new project with S2 and been asked to see if acegi will be a good idea to integrate into our new application. In our past projects, we've wrote our own 'interceptors' for authorization/authentication issues (and we are very confident with that)

I searched about acegi and couldn't see the added-value to our new project. Can anyone come with an example of how acegi can easily solve a problem that interceptors will be very hard to implement?

thanks for any thoughts.


9 years ago


Thank you John,

this one was what I was looking for!

When I do this:


it doesn't return all logs...GREAT!

But what if I wish to keep the option in other events/instances? can I do something with the criteria.add(Restrictions ???


BTW, I ordered your book - it had excellent reviews on amazon!
Hi all,

I'm playing with Hibernate and found it to be very easy (and potentially will save me a lot of SQLs)

Say I have the followings columns:

1. department
2. Employee
3. Employee_notes

Employee has 1 department_ID and 0..MANY notes.
When I get a list of departments


I get all information related to the employees (email...) AND THEIR NOTES.

Question: while this is excellent and save me a lot of work writing SQL statements, it's 'expensive'. What 'criteria.add(Restrictions' should I add in order to avoid getting the list of all notes.

Thank you!
Hi all,

I have a table with the following columns:

1. contact_id
2. fname
3. lname
4. email

The email column must be unique (unfortunately it's not); therefore, I have to delete all duplication in the system.

Question: how can I select all duplication in the table?

I tried this...didn't work (I'm expecting only the emails that are duplicated)

THANK YOU!


Thank you Cameron for the insight!

1. I corrected the code (annotation) on Employee and added


2. per your question:
*You are indeed getting departments back from your query, right? How many departments get returned when you size the list? (Just making sure stage one works before digging too deep).

YES! I get 3 departments
the code:

consult output:


you can see that there are no empls in the department, it says total 0...(but there are, when I run ListEmployees I can see what department he belongs to)

I have a Department Employee relationship (department has employeeS)


when I query for employee - I can get the department *Name* //name name of department is not unique (department_id is unique)




BUT when I do this


I don't get the list of all employees, why?

Employee:


and Department


Thank you!