Alex Paransky J

Greenhorn
+ Follow
since May 23, 2011
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 Alex Paransky J

I created a SmartGWT button and invoked it from /index.html, everything looks fine. Then I invoked it from /nested/index.html, the code loads, however, I see the browser is trying to load resources from .../nested/... and getting a 404 as my script and all resources are deployed at /. How do I work around this?

In other words, if I execute:



I always want to read everything from /printer-admin/BrandEditor/*. As it happens now, the code is loaded from this directory, however, resource requests are going to /printer-admin/nested/BrandEditor.

Alternatively, I could compile the module and place is relative to the page that's its going to be displayed from, however, I am not quite sure how to do that with Maven and the gwt-maven-plugin tool.

Thanks for any help.

-AP_
10 years ago
GWT
I am using GWT compiler in maven via the org.codehaus.mojo gwt-maven-plugin project. All the code seems to wind up in a subdirectory <ModuleName> which is located at the root of my webapp.

I created a directory called resources/js and would like the output to go there, so when looking at my .WAR instead of:



I want to see:



My mojo configuration looks like this:



Is there a way to make this happen?

Thanks.
-AP_
10 years ago
GWT
Thanks for your reply, but it would also be nice if you could let me know what are the conventions today. I already said that "back when I was using Struts", that is what was done. What is the convention or best practices now?

Like I said, when I used "/" my actions worked fine, but when I created some .js the servlet was invoked as well and the resource was not found. Perhaps I am not configuring my view resolvers correctly, this is what I have:



So, when a request for some .js came into the server, it was mapped to InternalResourceViewResolver and did not quite work as expected. Please, do let me know what is the proper way to do these types of mappings in today's applications?

Thanks.
-AP_
10 years ago
I am setting up my application and was wondering if there are best practices as far as mapping spring dispatch servlets and naming conventions in today's Spring MVC applications. For example, back when I was using Struts all the actions had a .do extension and that's how they mapped to the Struts servlet. Is this still the convention with Spring MVC or is it more path based now?

How about when creating REST services? Should the servlet be mapped with some sort of a common extension or using path conventions?

I noticed that some examples map using "/", however, that does not work when static resources such as images or JavaScript needs to be accessed as everything goes to the servlet for processing and creates exceptions.

Thanks.
-AP_
10 years ago
I am using Tiles2 with SpringMVC application. I added:


to the top of my layout, however, the tags are not being processed in my body. In other words, I get the following output:

If I add the taglib line to the top of the body, tags are working fine. I want to put the taglib in a single place and not have to always add them to every page that I write. Is there a way to do this?

Thanks.
-AP_
10 years ago
So, I have the Spring/Tiles2 integration working, however, it seems silly to always have to create view definitions as they all look the same with exception of title and body.

For example:



Is there a way to somehow remove the need to have view definitions, or remove a step in defining a new view? In other words, can /WEB-INF/jsp/brand/brandList.jsp, somehow include the tiles definition as well as the body that is to be rendered in it?

This is not a major issue, just trying to see if number of places where edits take place could be removed.

Thanks.
-AP_
10 years ago
I am just starting out with this stuff, but could you not use a Query to return you the children with this condition? Also, according to section 9.1.26 of the JPA spec the joinColumns and inverseJoinColumns are both arrays which can take more than one column, so could you not join on id AND surname and add surname to your join table?

-AP_
So, suppose I have a Department (1) -has- (n) Employee relationship (one department OneToMany Employee) that I am trying to model. I have the tables for Employee with a department_id as FK and department table.

If I map these as a bi-directional relationship, then from Employee I can get to department using Employee.getDepartment() : Department and from Department I can get all people using Department.getEmployees() : Collection<Employee>. Alternatively, I can use a Unidirectional mapping and only have the path from Employee to Department, but not have a collection in the Department representing the Employee. Of course, to get all the employees for the department I would need to use a query instead of just calling Department.getEmployees(). Is this what you mean? Which method is preferred?

Thanks.
-AP_
I am just starting with these technologies and I am coming from older EJB systems. I created a data model using POJO and mapped it to the database tables. Created repositories and wrapped everything in a Service which has transactional annotations. My relationships are mostly lazy so that I don't suck up the entire database when retrieving one object. So far, so good. I like it.

The question I have is regarding returning my POJO model beans from the Service interface.

If the service is accessed locally, then trying to read collections which have not been "touched" during transaction kicks off the Lazy loading process which by that time no longer has the session causing an exception to happen. Meanwhile most of the examples I saw tend to declare the POJO model objects as implementing Serializable which seems to indicate that no special Data Transfer objects are needed and the model POJOs can be used directly by the client of the Service.

Of course in the old EJB model we never returned the EntityBean to the client outside of the SessionBean and always used Data Transfer Objects to communicate between external client and internal EntityBeans through the SessionBeans. Is this still the case with Spring->Hibernate->JPA? According to my short experience with this technology it seems that Data Transfer Objects still should be used as a main interface between the client and the Service.

Is there something that I am missing?

Thanks.
-AP_
I get what you are saying with the code sample provided, however, m from your example could be associated with a different ONE. So, there is now a concept of oldONE and newONE. Thus we now need to remove from the old and add to the new. In addition a user of the class can call getMany() collection directly and add to it bypassing the addMany API entirely, so the collection needs to be returned as immutable. As you pointed out great care must be taken to do this without causing an infinite recursion. Since I am just starting out with this stuff, I am curious as to what people do. Do you write this type of code for every association?

This seems like a common pattern that would exist when ever you have bi-directional One-To-Many relationships. Do you know if there is anything in Spring that templates this?
I am just starting with ORM and JPA using Hibernate and have a question regarding managing the one-to-many relationship.

On the ONE side of the relationship we have getCollection() : Collection. On the MANY side we have a setter. Calling ONE.getCollection().add(...) does NOT update the many side by calling a corresponding setter. Calling the many side setter, does not perform getCollection().add(...). So, the two operations are not "mirror" of each other as otherwise expected. How are people working around this issue?

Do you implement the setter on the Many side to call back on the ONE.getCollection.add(this) and vice versa?

Thanks.
-AP_