Carlos Conti

Ranch Hand
+ Follow
since Apr 21, 2010
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carlos Conti

Hi there,

this is by far the weirdest situation I have seen.... I think this has happened once more in my programming experience, but can't remember how I exactly solved it.

I am debugging a set of web services in Netbeans 8.1. They consist of a set of REST web services requested by an android app. The web services highly rely on a backend  MySQL database and Hibernate layer. The point is that after querying an object  from the database and loading it with Hibernate, the child objects related to the parent object in a OneToMany relationship show correctly in the debugging popup labels (i.e. when moving the mouse over the variables), and values are populated. However the code execution reveals null values are assigned, although according to the debugger, the right hand operators are populated:

(To show what I mean)
Object a = ((List)b).get(0); ===> when moving the mouse over b, it shows the list and the populated child values, but after pressing F8 to get to the next statement, a is null according to the debugger, and subsequent statements throw NullPointerException's
Object c = a;
c.whatever()->throws NullPointerException

I am quite desperate since I have tried all possible cleaning commands, including restarting Netbeans and PC.

I think there's one last thing I could do that haven't done yet, which is deleting cached files on my project folder. However I am not sure which of them they are. Can anybody help please?

Many thanks for reading me, and hope this has happened someoneelse and can give a hand.

Regards,

Carlos.
1 year ago
Hi there,

I recently migrated our intranet app from Hibernate 4.1.7 to 4.3.1 and where objects weren't cached at all, now we find ourselves in a scenario where objects are presumably cached, then many times we update things that take quite a bit for the read operations to update.

Due to other reasons, in version 4.1.7 we set the flag CacheMode in the session object to IGNORE, but now that seems to have no effect.

Any ideas? This problem is becoming painful.

Thanks for any suggestions.

Regards,

Carlos.
Well these are too many warnings against triggers and there's definetely a drawback.... testing them is not straightforward.... whereas validation is.... will have some tests runni g tomorrow with triggers and will see....

Many thanks to all for the richful discussion on the subject. Has been very revealing.

Regards,

Carlos.
Hi Roel, and anyone this might interest. This link will be very useful in the context of this discussion:

http://cvuorinen.net/2013/05/validating-data-with-triggers-in-mysql/

Regards and if you don't mind Roel would be great if you could share your thoughts.


Carlos.
Hi Roel,

Thanks for this interesting discussion. After your last post I have checked some related links and come to a possible solution. I have never used triggers, but they seem to be the key to my problem. It seems that inside a check, besides testing insert values for a given table inside a beforeupdate trigger, I am also able to check for constraints involving other tables.

That would enable me to program the constraints you were talking about right?

That would be a fantastic solution, for I would be able to include that logic inside the database, with all the benefits that involves regardind database migrations and maintenance.

The more logic for data integrity purposes I can integrate in the database the better for longterm scalability.

So when you said to make use of all check constraint possibilities within MySql I guess you were pointing in this direction right?

Thanks and regards.

Carlos.


Hi Roel,

this is a quite dirty database with not very restricted supervision.
At certain times we have seen ourselves in the situation where manual overrides had to be done. Moreover I am not fully sure all foreign keys are promptly configured. IN our app we use hibernate and so far everything works as expected. But I wouldn't bet much on the correctness of the whole thing.

That's why. But additionally we need to test some business rules too. Any ideas?
Many thanks,

Carlos.
Hi there,

I have a db with over 170 tables. The db claims 8Gb of space (pictures, pdfs, etc...)

I find myself at the stage where I must guarantee and perform periodical checks of the data integrity for the data contained in this db. For that I have to test all foreign key relationships among the tables, besides running some logic rules to test that the data is congruent from a business perspective. In case any rule doesn't comply, must write a log in order to schedule data repairs.

I have two strategies:

1) Write the rules myself with plain SQL and Java and check them against the db.

2) Use any tool you guys suggest me to check! ;D

Please help. I guess a complete check would mean writting over 800 rules. So it is a bunch of work!... is there any nice db managers tool that eases that process??? It must! must only find it!

Please point me in the right direction.

Many many thanks for your help!

Regards,

Carlos.
Hi there,

I need to setup a replication database in the form of a mirror so that our backend database is replicated overnight or in realtime if possible in order to maintain secure copies of our data outside of our office boundaries.

Does anyone know how to attain this? Ideally we would like to maintain two identical copies of the same database, in the most synchronized fashion, say a change in database A causes A' to be updated in a matter of seconds.

I am completely lost on this subject and if anyone could shed some light would be of great help.

Does anyone offer such service? I guess for huge webapps this is a must, to distribute big amounts of db requests...

We are willing to build it in order to maintain secure copies of our data.

Many thanks for your attention and time.

Regards,

Carlos.
Hi all,

we are currently developig our system with the SVN versión control system. Due to emerging project requirements we are going to introduce Maven in our overall developing and deployment strategy.

I have checked some tutorials and seen (or at least seems like) that SVN and Maven are compatible. My question is what is the recommended way to go and if anyone can point me to a tutorial even better. However I am sure the Apache Maven site will hold all documentation I need to proceed.

Now the question:

we are a team of 3 developers. Should each one of them hold his own Maven repository or base all of us in a remote one?. The question might seem pretty obvious in favor of the remote repository, but the point is if Maven will easilily and successfully manage different versions, and in the end be able to retrieve the most uptodate versión of the system.

On the other hand it seems meaningful to me that everyone holds his own repository, for finally publishing to a generic one.

If anyone has any experience with this it would be of great help if you could share some hints.

Many thanks in advance,

Carlos Conti.
Hi all,

thanks for the short discussion. After some trial error and research we finally found the root of our problems and effectively cleaned up resources in a standard manner. As Dave Tolls pointed, the circular reference was not the issue, but some static instances which where holding A objects without a foreseen unload() schema.

But holoding instances from A, B or C, as long as there is no other participant and references exist only among those references is fine. They are all GC'ed once you detach them from the GUI classes as a whole.

We were attaining the job manually where there was already an automated task.

Many thanks,

Carlos Conti.
3 years ago
I am trying to launch an application based on Hibernate.

I am getting the following exception:

java.lang.NoSuchFieldError: name
at org.slf4j.impl.Log4jLoggerAdapter.<init>(Log4jLoggerAdapter.java:75)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:75)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:103)
at org.hibernate.cfg.annotations.Version.<clinit>(Version.java:12)
at org.hibernate.cfg.AnnotationConfiguration.<clinit>(AnnotationConfiguration.java:78)
at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:107)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersisten


This claims to be a library version conflict issue. Can anyone give me a hint? Find my POM.xml here:



Many many thanks in advance. Is there any source where this can be checked? or it is a matter of experience and knowledge? Or can I find out the proper versions by analyzing Maven dependencies?

Best regards,

Carlos.
Hi Paul, many thanks.

Where is the no problem if you leave those references there... in the end they turn out to be tiny memory leaks.... which will add up heap usage and increase the chances of OutOfMemory errors upon throughput or traffic increase... or is there a point in time where they will be GC'd?. If so under which criteria?

My strategy consists on cleaning up after use. This way I can guarantee OoM errors will only appear due to heavy usage.... where I can estimate average user heap needs and making the ammendments in the server accordingly for a foreseen concurrent user base.

What do you think? I am not an expert on this subject but this appears to be correct. Would you suggest differently?

Thanks,
Carlos.
3 years ago
Hi,

I have an application where in a simplified manner I have several object which interact with eachother in the fashion:

class A{

B b = new B(a);
C c = new C(a);


}

class B {... redundant...} //bear in mind it is holding an A reference

class C {... redundant...} //bear in mind it is holding an A reference

All classes are mapped to an Hibernate persistence layer.
When I finish an edition UserCase on an instance of class A, I want all of it to become eligible for garbage collection. What I do is to cancel all references from the UserCase code to the A instance to become null, for the A object to become eligible for Garbage Collection. The point is that since the B and C objects hold references to the A object, A isn't Garbage Collected, I presume because the A object is still referenced by B and C. But under this assumption, what I need to do is to manually deconstruct the A object so that B and C have its A reference set to null, for the A object to be finally collected. Similarly I would have to do the same thing for B and C, should their instances be hold somewhere.

This is a big simplification. My model consists of over 150 classes and that means I have to build a standardized method of attaining this if I want to avoid programming a deconstruction method for each class in the model.

Since every class is hibernate annotated, I can figure out a (not so easy to do) task to accomplish that.

However if anybody knows a quicker way, I would really love to know about it, then it would save quite a lot of research time.

Do I have to push for that solution? Or does anyone know a more straightforward method?

Many thanks in advance for your insights.

Regards,

Carlos.
3 years ago
Hello, I'm developing a Java Application with several users (can be at same time). I have a Servlet static , and I'm trying to free memory so I would like to unload o stop it.

How I could do it? Thank you in advance.
3 years ago
Hi Dave,

I finally managed. Had some problems understanding the logic of JMeter, but found a couple of good tutorials and could finally do what I was aiming.

Many thanks for your time.
Carlos.
3 years ago