Category Archives: Fix Lỗi

[Fixed] Update maven error repository cache local on windows + linux

I./ On Windows:

cd %userprofile%\.m2\repository for /r %i in (*.lastUpdated) do del %i
II./ On Linux:
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;

Advertisements

[Fixed] Hibernate Error: a different object with the same identifier value was already associated with the session(lazy load)

Before:


public boolean updateUserStory(UserStory userStory) {
try {
Session session = sessionFactory.getCurrentSession();
session.update(userStory);
return true;
} catch (HibernateException e) {
e.printStackTrace();
return false;
}

}

After:

@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
public boolean updateUserStory(UserStory userStory) {
try {
Session session = sessionFactory.getCurrentSession();
session.merge(userStory);
return true;
} catch (HibernateException e) {
e.printStackTrace();
return false;
}

}

References:

[1]. http://stackoverflow.com/questions/3265765/hibernate-a-different-object-with-the-same-identifier-value-was-already-associ

[2]. http://stackoverflow.com/questions/10849974/a-different-object-with-the-same-identifier-value-was-already-associated-with-th

[Fixed] Import existing maven project in eclipse: “could not update maven”

Step 1: delete the project in eclipse.

Step 2: remove “ .classpath, .settings and .project ” outside (on linux you must enter command)

Step 3: import the project back into eclipse.

Step 4: make sure you have a 2.5 web.xml

Step 5:  specifically set the maven-compiler-plugin version to 1.5 in the pom.xml

<build>
...
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
...
</plugins>
</build>
Advanced programming

Tự học lập trình Android, android wear - lập trình smartwatch, Windows phone, Web service, C++, C#, java, Swift, Python, kotlin...

Tôi IT - Change the world

Research + Technical -> Programming,

juliansherman.net/

Building A Business While Having A Life

VN.NVANHUONG

No Pain No Gain

Study and Share's Blog

Việt Nam tươi đẹp...

Broly

One of the best way to learn is by writing to the paper.