Satya Maheshwari

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

Recent posts by Satya Maheshwari

Andrew Fitzpatrick wrote:Hi, I just got exactly the same problem and managed to fix it.

The problem is classpath related and to do with the order of jar and class files. To solve right click on the project in Eclipse and select properties, click the Order and Export tab. Now use the buttons on the right hand side to move the java runtime up so that it appears before all library jar files, ensure your project files still precede this library though.

A refresh on the project should see it rebuilt without issue.

Excellent!! Thanks so much!!
11 years ago

E Armitage wrote:

You're stuck with using single table strategy if you want the discriminator column.

Thanks for sharing the information!
I have 2 entities, 'Principal' and 'Resource'. 'Principal' implements resource and has a 'Joined' inheritance strategy with resource. 'Resource' entity has a DiscriminatorColumn called 'RESOURCE_TYPE' while the 'Principal' entity has a discriminator value of 'PRINCIPAL'. Now the problem that I am facing is that the discriminator column is neither getting created not populated in the 'Resource' table when I create a 'Principal'. I am using jboss-5 with Hibernate as the persistence provider. Below is the source code.

I would really appreciate if you could help me out.
Hi Anayonkar, thanks for replying!!

Basically I have several entity beans on top of corresponding DB tables which I mentioned as data classes in the post. Yes reflection is the way I would do it if there isn't any already existing pattern for doing it.
12 years ago
I have a requirement wherein I have several data classes (classes which just have members and their getter and setters) and I need to instantiate them using a map that is passed to it. The map has the name value pairs. I want to generalize this process instead of doing this specifically in the constructor of each data class.

One option is to define a parent class of all the data classes and do introspection in its constructor and use the hashmap for setting the values.

But is there an already existing standard way of doing it so that I do not end up reinventing the wheel.
12 years ago
Thanks Martin!
Yes, I was thinking on similar lines but now when I know that it is a known java practice, I am a bit more reassured.
12 years ago
Thanks for replying!!
Let me add the exact details. Maybe there is a problem with the design itself.
Basically I have a class called graph which gets a set of vertices and a set of edges in the constructor. There are getters for these sets as well in the class. Now I want to avoid any additions/deletions to these sets outside the graph class except the explicit call to graph.addVertex or graph.addEdge. This is necessary to avoid any graph manipulations without the graph class knowing about it.
12 years ago

Jeff Verdegan wrote:Inside your class, use the collection normally. But don't expose the raw collection to the outside world. For that, use the unmodifiable collection.

Thanks jeff for replying! Your suggestion would be perfect if the collection was being instantiated inside the class. But unfortunately it's being passed as an argument to the class.
12 years ago
Is their some existing mechanism using which I can enforce that a collection is modifiable only in specific class(es) and is read-only elsewhere?I had a look a unmodifiable collection but they are unmodifiable everywhere.
12 years ago
You could figure out the code throwing NPE by looking at the .java file generated for the jsp throwing the error. In case you are using tomcat, its placed in the work directory.
12 years ago
thanks tim for replying!!
but i do not think jd-core is available as standalone.
12 years ago

I am looking for a java decompiler which has a java programmatic interface and I can use it from within my program. Please suggest.
12 years ago
If I may, this is the way I look at generics. Whenever there is a generic type specified, ask yourself, if that collection were a closed bag, what could you conclusively say about the contents of that bag.

Let's consider a class hierarchy as follows for simplicity:

Let's say we have bag called Collection<Apple>. I can conclusively say that this bag contains
2.Fruits (because apple IS A fruit)

Let's say we have bag called Collection<? extends Apple>. I can conclusively say that this bag contains
2.Fruits (because any type of apple IS A fruit)

I cannot say that this bag contains Red Apples as this bag may also contain green apples

Let's say we have bag called Collection<? super Apple>. I can conclusively say that this bag contains
1.Something (equivalent to Object in java)

I cannot say anything else conclusively about this bag.
Your understanding concurs with ets provided answer. Otherwise which other answer do you suggest?
Even though you have not provided equals, its inherited from Object.