Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

amar rajula

Greenhorn
+ Follow
since Sep 01, 2007
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 amar rajula


The following setting are in catalina.sh file in Linux box under production servers

There are 4 Nodes has the same configuration.

export JAVA_OPTS='-Xms3328m -Xmx3328m -XX:NewRatio=1 -XX:SurvivorRatio=4 -server -Xverify:none -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/apache-tomcat-6.0.35-1/logs -XX:+DisableExplicitGC -XX:+UsePerfData -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=3 -XX:+PrintGCDateStamps -XX:+UseCMSInitiatingOccupancyOnly -XX:+PrintGCDetails -XX:-PrintTenuringDistribution -XX:+UseCompressedOops -XX:TargetSurvivorRatio=90 -XX:CMSInitiatingOccupancyFraction=75 -XX:PermSize=128m -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=80m -Xloggc:/opt/prpc/prpclogs/app05-ms1/GC.log -Djava.awt.headless=true'


some times facing performace issues.
Would like to know the mentioned heap size and perm Size are correct? any advices are most WellCome.


9 years ago
It is working now.
Thank you very much for you both.
Hi,
i am new to hibernate, i am following with hibernate tutorial.
DB : HSQLBD


storing records succussfully but Could not able to retrive the records.
Facing problem with table mapping.

ERROR :


run:
[java] Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxExceptio
n: EVENTS is not mapped [FROM EVENTS]
[java] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassP
ersister(SessionFactoryHelper.java:158)
[java] at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(
FromElementFactory.java:87)
[java] at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClau
se.java:70)
[java] at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWa
lker.java:255)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBa
seWalker.java:3056)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlS
qlBaseWalker.java:2945)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBas
eWalker.java:688)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalk
er.java:544)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlS
qlBaseWalker.java:281)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBase
Walker.java:229)
[java] at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTransl
atorImpl.java:228)
[java] at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTran
slatorImpl.java:160)
[java] at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTransl
atorImpl.java:111)
[java] at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.j
ava:77)
[java] at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.j
ava:56)
[java] at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(Que
ryPlanCache.java:72)
[java] at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(Abstra
ctSessionImpl.java:133)
[java] at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSe
ssionImpl.java:112)
[java] at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1
623)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at org.hibernate.context.ThreadLocalSessionContext$TransactionPr
otectionWrapper.invoke(ThreadLocalSessionContext.java:301)
[java] at $Proxy0.createQuery(Unknown Source)
[java] at events.EventManager.listEvents(Unknown Source)
[java] at events.EventManager.main(Unknown Source)
[java] Java Result: 1

code:

Event.hbm.xml
-------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

<class name="events.Event" table="EVENTS" >
<id name="id" column="EVENT_ID">
<generator class="increment"/>
</id>
<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>
</class>

</hibernate-mapping>


EventManager.java
----------------
package events;
import org.hibernate.Query;
import org.hibernate.Session;


import java.util.Date;
import java.util.List;


import util.HibernateUtil;

public class EventManager {

public static void main(String[] args) {
EventManager mgr = new EventManager();

if (args[0].equals("store")) {
mgr.createAndStoreEvent("My Event", new Date());
}else if (args[0].equals("list")) {
List events = mgr.listEvents();
for (int i = 0; i < events.size(); i++) {
Event theEvent = (Event) events.get(i);
System.out.println("Event: " + theEvent.getTitle() +
" Time: " + theEvent.getDate());
}
}

HibernateUtil.getSessionFactory().close();
}

private void createAndStoreEvent(String title, Date theDate) {

Session session = HibernateUtil.getSessionFactory().getCurrentSession();

session.beginTransaction();

Event theEvent = new Event();

theEvent.setTitle(title);
theEvent.setDate(theDate);

session.save(theEvent);

session.getTransaction().commit();


}
private List listEvents() {

Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();

List result = session.createQuery("FROM EVENTS").list();

session.getTransaction().commit();
return result;
}

}

please any body can help me?

Thanks in advance.

regards,
Amar