cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure Hibernate related jars in my net weaver

Former Member
0 Kudos

Hi,

can you please tell me how to configure and add jars to my net weaver.

I have already downloaded jars with version 3.0.5.please tell me the procedure to all configurations to my net weaver so that i can run hibernate applications in my net weaver.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

have a look at <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/14f55178-0801-0010-0bac-974ed17e51d3">this</a> guide.

Former Member
0 Kudos

Hi,

I am using maxdb for hibernate.if possible please give me the proper links.

kishorg
Advisor
Advisor
0 Kudos

Hi Bhogi,

<u>Design time</u>

You need to add these jar files as external library references in the NWDStudio project itself.(Needed for design time)..

<u>Runtime</u>

For runtime , this is running from the server itself . so u have to deploy the library files to the SAP J2EE WAS itself.

<u>for this...</u>

define a SAP J2EE library

deploy it and

set a reference from each Hibernate application to this library .

These are some good links..

https://www.sdn.sap.com/irj/sdn/docs?rid=/webcontent/uuid/e081a4b6-0801-0010-7fa4-c3c7a0454815#hiber... [original link is broken]

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/2ae0614a-0601-0010-a491-a9a...

Regards

Kishor Gopinathan

Former Member
0 Kudos

While running my application in using netweaver i encountered this problem.

org.hibernate.HibernateException: /hibernate.cfg.xml not found

at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)

at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1287)

at org.hibernate.cfg.Configuration.configure(Configuration.java:1309)

at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)

at com.capgemini.nl.MessageController.doGet(MessageController.java:25)

at com.capgemini.nl.MessageController.doPost(MessageController.java:53)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

kishorg
Advisor
Advisor
0 Kudos

Hi Bhogi ,

<< /hibernate.cfg.xml not found>>>

To setup your hibernate configuration you can use a XML document (hibernate.cfg.xml) or a plain text document (hibernate.properties). I recommend to use the XML format because it is easier to configure more advanced features like caching. I only added the minimal configuration settings to get Hibernate running. For more advanced settings see the official Hibernate Reference Documentation. Instead of using the default datasource you can also use a custom JNDI datasource which you added to your project. Don’t forget to add ‘java:comp/env/’ if you make use of a self-defined JNDI datasource. The Hibernate configuration file should be stored in the WEB-INF/classes folder of your web project. In the mapping files section you can add your persistent classes. Another option is to add your persistent classes when you create a Hibernate Configuration object.

Edited ,,

-


Every class that needs to be persisted using Hibernate should be accompanied by a mapping configuration file. This file should be named <class name>.hbm.xml and it should be stored in the same folder as the .java file of the class.

Have u entered the reference of <ClassName>.hbm.xml in the mapping section of original hibernate.cfg.xml file..

u have to enter

<mapping resource="<package wise >/Message.hbm.xml" />

<package wise >

if the Message.hbm.xml file is in the package..

test.hiber.msg

then u have to enter ---

<mapping resource="test/hiber/msg/Message.hbm.xml" />

in hibernate.cfg.xml in the mapping section..

Regards

Kishor Gopinathan

Message was edited by: Kishor Gopinathan

Message was edited by: Kishor Gopinathan

Message was edited by: Kishor Gopinathan

Former Member
0 Kudos

while i am running my application ,i am getting below error

org.hibernate.MappingException: Unknown entity: Message

at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:513)

at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1321)

at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:89)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)

at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)

at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)

at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:559)

at org.hibernate.impl.SessionImpl.save(SessionImpl.java:547)

at org.hibernate.impl.SessionImpl.save(SessionImpl.java:543)

at com.capgemini.nl.MessageController.doGet(MessageController.java:33)

at com.capgemini.nl.MessageController.doPost(MessageController.java:53)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Former Member
0 Kudos

Hi everyone!

Ivaylo, the guide you suggested states:

One may put these JARs in the application context, which is possible but not recommended. The better way is to
• define a SAP J2EE library [...]

We're currently using Hibernate 3.1.2 for a application under NW04 SP14 in the "not recommended" way, having the .jar archives in .../dist/PORTAL-INF/private/lib. Are there drawbacks/sideeffects expected when doing it like this? I mean: memory leaks, etc.

Thanks in advance,

Victor

Former Member
0 Kudos

Hi Victor,

the difference is that if you deploy the libs in the application context, they are loaded by the application loaders. If you deployed the libraries with N apps, it'll be loaded N times.

If you deploy it as a standalone library, you load it once on server startup, and then use it by many apps by classloader's references..

Now I guess you can decide by yourself whether this will have any drawbacks in your specific case, or not.

Former Member
0 Kudos

Hi Ivaylo,

thanks for your reply, but, lol, that's not what I meant I should have elaborated further what I'd like to know.

It's very clear to me how bad it is when e.g. the 10th XML parser is loaded by some application. Luckily that's currently not an issue, my project is the first -and currently only one- using Hibernate in the target EP. And while still testing, we left the Hibernate3 libraries in the application private lib directory.

My question targets the subtle sideeffects of having the H3 libraries in the app private dir. To be more specific: memory leaks or memory footprint increase. Could such occur? Has anyone experienced this?

We've encountered some OOM situations, occuring after a longer series of redeployments (.par file including H3 libs in app private lib dir), and are trying to enlight all possible faces of this issue.

Former Member
0 Kudos

Ivaylo,

this is the kind of information I was looking for:

http://sourceforge.net/project/shownotes.php?release_id=403223&group_id=40712

bug [HHH-1236].

Victor

kishorg
Advisor
Advisor
0 Kudos

Hi Bhogi ,

r u talking about adding external jar files to your particular project that is developing in NWD Studio ?

OR

adding additional plugins to the Developer Studio?

Regards

Kishor Gopinathan

Former Member
0 Kudos

HI,

Thanks for sending the response.I am using external jars.So now please let me know how to use these jars and configure them to run applications of hibernate.