[Persistence, JBoss/CMP, Hibernate, Database] - EJB Deploynment with JBoss and use of hibernate
by aneta
Hello,
ths is ok as I specified the hibernate-dialect correctly. Jboss deployed the application and I have a table "book" in my mysql. Now I still can enter or manipulate data.
This is my JBoss-Stacktrace:
16:22:53,535 INFO [Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0
-8080
16:22:53,691 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
16:22:53,707 INFO [JkMain] Jk running ID=0 time=0/47 config=null
16:22:53,785 INFO [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Bran
ch_4_0 date=200610162339)] Started in 35s:531ms
16:23:04,379 INFO [Ejb3Deployment] EJB3 deployment time took: 656
16:23:04,379 INFO [JmxKernelAbstraction] installing MBean: persistence.units:ja
r=FirstEJB3Tutorial.jar,unitName=FirstEjb3Tutorial with dependencies:
16:23:04,379 INFO [JmxKernelAbstraction] jboss.jca:name=ejb3ExampleDS,ser
vice=DataSourceBinding
16:23:04,441 INFO [Version] Hibernate EntityManager 3.2.0.CR2
16:23:04,457 INFO [Version] Hibernate Annotations 3.2.0.CR2
16:23:04,473 INFO [Environment] Hibernate 3.2.0.ga
16:23:04,488 INFO [Environment] hibernate.properties not found
16:23:04,488 INFO [Environment] Bytecode provider name : javassist
16:23:04,488 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
16:23:04,660 INFO [Ejb3Configuration] found EJB3 Entity bean: de.laliluna.libra
ry.Book
16:23:04,660 WARN [Ejb3Configuration] Persistence provider caller does not impl
ements the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is n
ull.
16:23:04,754 INFO [Configuration] Reading mappings from resource: META-INF/orm.
xml
16:23:04,769 INFO [Ejb3Configuration] [PersistenceUnit: FirstEjb3Tutorial] no M
ETA-INF/orm.xml found
16:23:04,848 INFO [AnnotationBinder] Binding entity from annotated class: de.la
liluna.library.Book
16:23:04,926 INFO [EntityBinder] Bind entity de.laliluna.library.Book on table
book
16:23:05,191 INFO [ConnectionProviderFactory] Initializing connection provider:
org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
16:23:05,207 INFO [InjectedDataSourceConnectionProvider] Using provided datasou
rce
16:23:05,519 INFO [SettingsFactory] RDBMS: MySQL, version: 4.1.18-nt
16:23:05,519 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version:
mysql-connector-java-5.0.6 ( $Date: 2007-03-09 22:13:57 +0100 (Fri, 09 Mar 2007
) $, $Revision: 6341 $ )
16:23:05,551 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
16:23:05,551 INFO [TransactionFactoryFactory] Transaction strategy: org.hiberna
te.ejb.transaction.JoinableCMTTransactionFactory
16:23:05,551 INFO [TransactionManagerLookupFactory] instantiating TransactionMa
nagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
16:23:05,566 INFO [TransactionManagerLookupFactory] instantiated TransactionMan
agerLookup
16:23:05,566 INFO [SettingsFactory] Automatic flush during beforeCompletion():
disabled
16:23:05,566 INFO [SettingsFactory] Automatic session close at end of transacti
on: disabled
16:23:05,566 INFO [SettingsFactory] JDBC batch size: 15
16:23:05,566 INFO [SettingsFactory] JDBC batch updates for versioned data: disa
bled
16:23:05,566 INFO [SettingsFactory] Scrollable result sets: enabled
16:23:05,566 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
16:23:05,566 INFO [SettingsFactory] Connection release mode: auto
16:23:05,566 INFO [SettingsFactory] Maximum outer join fetch depth: 2
16:23:05,566 INFO [SettingsFactory] Default batch fetch size: 1
16:23:05,566 INFO [SettingsFactory] Generate SQL with comments: disabled
16:23:05,566 INFO [SettingsFactory] Order SQL updates by primary key: disabled
16:23:05,566 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.AST
QueryTranslatorFactory
16:23:05,566 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
16:23:05,566 INFO [SettingsFactory] Query language substitutions: {}
16:23:05,566 INFO [SettingsFactory] JPA-QL strict compliance: enabled
16:23:05,566 INFO [SettingsFactory] Second-level cache: enabled
16:23:05,566 INFO [SettingsFactory] Query cache: disabled
16:23:05,566 INFO [SettingsFactory] Cache provider: org.hibernate.cache.Hashtab
leCacheProvider
16:23:05,582 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
16:23:05,582 INFO [SettingsFactory] Structured second-level cache entries: disa
bled
16:23:05,582 INFO [SettingsFactory] Statistics: disabled
16:23:05,582 INFO [SettingsFactory] Deleted entity synthetic identifier rollbac
k: disabled
16:23:05,582 INFO [SettingsFactory] Default entity-mode: pojo
16:23:05,644 INFO [SessionFactoryImpl] building session factory
16:23:06,332 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no
JNDI name configured
16:23:06,348 INFO [SchemaExport] Running hbm2ddl schema export
16:23:06,348 INFO [SchemaExport] exporting generated schema to database
16:23:06,379 WARN [JDBCExceptionReporter] SQL Warning: 1051, SQLState: 42S02
16:23:06,379 WARN [JDBCExceptionReporter] Unknown table 'book'
16:23:06,441 WARN [JDBCExceptionReporter] SQL Warning: 1051, SQLState: 42S02
16:23:06,441 WARN [JDBCExceptionReporter] Unknown table 'book'
16:23:06,441 INFO [SchemaExport] schema export complete
16:23:06,473 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.fa
ctory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.p
kgs=org.jboss.naming:org.jnp.interfaces}
16:23:06,535 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=First
EJB3Tutorial.jar,name=BookTestBean,service=EJB3 with dependencies:
16:23:06,535 INFO [JmxKernelAbstraction] persistence.units:jar=FirstEJB3T
utorial.jar,unitName=FirstEjb3Tutorial
16:23:06,941 INFO [EJBContainer] STARTED EJB: de.laliluna.library.BookTestBean
ejbName: BookTestBean
16:23:07,051 INFO [EJB3Deployer] Deployed: file:/C:/Programme/JBoss/jboss-4.0.5
.GA/server/default/deploy/FirstEJB3Tutorial.jar
Why is book unknown as it exists in mysql?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056921#4056921
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056921
18Â years, 10Â months
[JBoss jBPM] - Re: beginner question...
by cristian_e
Maybe you can add a transition from the node where the process instance is located after the data has been submitted pointing back to the initial state (the one related to the input of data). Programatically you can choose which path the token is going to follow.
Other approach we have used is to have two phases in the input stage:
- At the first part, the user only inputs data and saves it. At any time he can modify it and save it again.
- Only when the user is sure the data is correct he commits it, and only then the corresponding process instance is signalled to the next state.
This way we avoid moving the token back and let the user confirm the information he is sending.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056914#4056914
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056914
18Â years, 10Â months
[JBoss Seam] - Re: UnitTesting Components
by KnisterPeter
Ok, below is the JUnit4 version of SeamTest. If there is interest it could be included into seam. There are only small changes which could be refactored into a subclass so both TestNG and JUnit4 share a common base class.
In details the differences are the init and shutdown methods annotated with @Configuration.
But I still have a problem: I need a mock instance for one of my beans and therefore (as stated in the docs) I extend my bean and set the @Install with a precedence of MOCK, but the mock bean is not included and started in the container. Are there examples on how to use the MOCK precedence? I haven't found any in the source and examples.
/**
| * $Id$
| */
| package de.llynch.kingpin.bean;
|
| import java.lang.reflect.Field;
| import java.util.AbstractSet;
| import java.util.Collections;
| import java.util.HashMap;
| import java.util.Iterator;
| import java.util.List;
| import java.util.Map;
| import java.util.Set;
|
| import javax.faces.application.Application;
| import javax.faces.application.FacesMessage;
| import javax.faces.component.UIViewRoot;
| import javax.faces.context.FacesContext;
| import javax.faces.event.PhaseEvent;
| import javax.faces.event.PhaseId;
| import javax.naming.InitialContext;
| import javax.naming.NamingException;
| import javax.servlet.http.Cookie;
| import javax.servlet.http.HttpServletRequest;
| import javax.servlet.http.HttpSession;
| import javax.transaction.UserTransaction;
|
| import org.hibernate.validator.ClassValidator;
| import org.hibernate.validator.InvalidValue;
| import org.jboss.seam.Component;
| import org.jboss.seam.Model;
| import org.jboss.seam.actionparam.ActionParamMethodBinding;
| import org.jboss.seam.contexts.Contexts;
| import org.jboss.seam.contexts.Lifecycle;
| import org.jboss.seam.core.Expressions;
| import org.jboss.seam.core.FacesMessages;
| import org.jboss.seam.core.Init;
| import org.jboss.seam.core.Manager;
| import org.jboss.seam.core.Pageflow;
| import org.jboss.seam.init.Initialization;
| import org.jboss.seam.jsf.AbstractSeamPhaseListener;
| import org.jboss.seam.jsf.SeamApplication11;
| import org.jboss.seam.jsf.SeamNavigationHandler;
| import org.jboss.seam.jsf.SeamPhaseListener;
| import org.jboss.seam.jsf.SeamStateManager;
| import org.jboss.seam.mock.MockApplication;
| import org.jboss.seam.mock.MockExternalContext;
| import org.jboss.seam.mock.MockFacesContext;
| import org.jboss.seam.mock.MockHttpServletRequest;
| import org.jboss.seam.mock.MockHttpSession;
| import org.jboss.seam.mock.MockLifecycle;
| import org.jboss.seam.mock.MockServletContext;
| import org.jboss.seam.servlet.ServletSessionImpl;
| import org.jboss.seam.util.Naming;
| import org.jboss.seam.util.Reflections;
| import org.jboss.seam.util.Transactions;
| import org.junit.After;
| import org.junit.AfterClass;
| import org.junit.Before;
| import org.junit.BeforeClass;
|
| /**
| * Code is copied from SeamTest which is for TestNG instead of JUnit4.
| *
| * @author Markus Wolf
| */
| public abstract class AbstractSeamTest {
|
| private static MockExternalContext externalContext;
|
| private static MockServletContext servletContext;
|
| private static MockApplication application;
|
| private static AbstractSeamPhaseListener phases;
|
| private MockHttpSession session;
|
| private static Map<String, Map> conversationViewRootAttributes;
|
| private final Map<String, Object> pageParameters = new HashMap<String, Object>();
|
| protected void setParameter(final String name, final String value) {
| this.getParameters().put(name, new String[] { value });
| }
|
| protected void setPageParameter(final String name, final Object value) {
| this.pageParameters.put(name, value);
| }
|
| protected Map<String, String[]> getParameters() {
| return ((MockHttpServletRequest) this.externalContext.getRequest())
| .getParameters();
| }
|
| protected Map<String, String[]> getHeaders() {
| return ((MockHttpServletRequest) this.externalContext.getRequest())
| .getHeaders();
| }
|
| protected HttpSession getSession() {
| return (HttpSession) this.externalContext.getSession(true);
| }
|
| protected boolean isSessionInvalid() {
| return ((MockHttpSession) this.getSession()).isInvalid();
| }
|
| /**
| * Helper method for resolving components in the test script.
| */
| protected Object getInstance(final Class clazz) {
| return Component.getInstance(clazz);
| }
|
| /**
| * Helper method for resolving components in the test script.
| */
| protected Object getInstance(final String name) {
| return Component.getInstance(name);
| }
|
| /**
| * Is there a long running conversation associated with the current request?
| */
| protected boolean isLongRunningConversation() {
| return Manager.instance().isLongRunningConversation();
| }
|
| /**
| * Search in all contexts
| */
| public Object lookup(final String name) {
| return Contexts.lookupInStatefulContexts(name);
| }
|
| /**
| * @deprecated use FacesRequest or NonFacesRequest
| * @author Gavin King
| */
| @Deprecated
| public abstract class Script extends Request {
| public Script() {
| }
|
| public Script(final String conversationId) {
| super(conversationId);
| }
| }
|
| /**
| * Script is an abstract superclass for usually anonymous inner classes that
| * test JSF interactions.
| *
| * @author Gavin King
| */
| abstract class Request {
| private String conversationId;
|
| private String outcome;
|
| private boolean validationFailed;
|
| private MockFacesContext facesContext;
|
| private String viewId;
|
| private boolean renderResponseBegun;
|
| private boolean renderResponseComplete;
|
| private boolean invokeApplicationBegun;
|
| private boolean invokeApplicationComplete;
|
| private Application application;
|
| /**
| * Override to define the name of the current principal
| *
| * @return "gavin" by default
| */
| public String getPrincipalName() {
| return "gavin";
| }
|
| /**
| * Override to define the roles assigned to the current principal
| *
| * @return a Set of all roles by default
| */
| public Set<String> getPrincipalRoles() {
| return new AbstractSet<String>() {
| @Override
| public boolean contains(final Object o) {
| return true;
| }
|
| @Override
| public Iterator<String> iterator() {
| throw new UnsupportedOperationException();
| }
|
| @Override
| public int size() {
| throw new UnsupportedOperationException();
| }
| };
| }
|
| public List<Cookie> getCookies() {
| return Collections.EMPTY_LIST;
| }
|
| /**
| * A script for a JSF interaction with no existing long-running
| * conversation.
| */
| protected Request() {
| }
|
| /**
| * A script for a JSF interaction in the scope of an existing
| * long-running conversation.
| */
| protected Request(final String conversationId) {
| this.conversationId = conversationId;
| }
|
| /**
| * Is this a non-faces request? Override if it is.
| *
| * @return false by default
| */
| protected boolean isGetRequest() {
| return false;
| }
|
| /**
| * The JSF view id of the form that is being submitted or of the page
| * that is being rendered in a non-faces request. (override if you need
| * page actions to be called, and page parameters applied)
| */
| protected String getViewId() {
| return this.viewId;
| }
|
| protected void setViewId(final String viewId) {
| this.viewId = viewId;
| }
|
| /**
| * Override to implement the interactions between the JSF page and your
| * components that occurs during the apply request values phase.
| */
| protected void applyRequestValues() throws Exception {
| }
|
| /**
| * Override to implement the interactions between the JSF page and your
| * components that occurs during the process validations phase.
| */
| protected void processValidations() throws Exception {
| }
|
| /**
| * Override to implement the interactions between the JSF page and your
| * components that occurs during the update model values phase.
| */
| protected void updateModelValues() throws Exception {
| }
|
| /**
| * Override to implement the interactions between the JSF page and your
| * components that occurs during the invoke application phase.
| */
| protected void invokeApplication() throws Exception {
| }
|
| /**
| * Set the outcome of the INVOKE_APPLICATION phase
| */
| protected void setOutcome(final String outcome) {
| this.outcome = outcome;
| }
|
| /**
| * Get the outcome of the INVOKE_APPLICATION phase
| */
| protected String getInvokeApplicationOutcome() {
| return this.outcome;
| }
|
| /**
| * Override to implement the interactions between the JSF page and your
| * components that occurs during the render response phase.
| */
| protected void renderResponse() throws Exception {
| }
|
| /**
| * Override to set up any request parameters for the request.
| *
| * @deprecated use beforeRequest()
| */
| @Deprecated
| protected void setup() {
| }
|
| /**
| * Make some assertions, after the end of the request.
| */
| protected void afterRequest() {
| }
|
| /**
| * Do anything you like, after the start of the request. Especially, set
| * up any request parameters for the request.
| */
| protected void beforeRequest() {
| this.setup();
| }
|
| /**
| * Get the view id to be rendered
| *
| * @return the JSF view id
| */
| protected String getRenderedViewId() {
| if (Init.instance().isJbpmInstalled()
| && Pageflow.instance().isInProcess()) {
| return Pageflow.instance().getPageViewId();
| } else {
| // TODO: not working right now, 'cos no mock navigation handler!
| return this.getFacesContext().getViewRoot().getViewId();
| }
| }
|
| /**
| * @deprecated use validateValue()
| */
| @Deprecated
| protected void validate(final Class modelClass, final String property,
| final Object value) {
| final ClassValidator validator = Model.forClass(modelClass)
| .getValidator();
| final InvalidValue[] ivs = validator.getPotentialInvalidValues(
| property, value);
| if (ivs.length > 0) {
| this.validationFailed = true;
| final FacesMessage message = FacesMessages.createFacesMessage(
| FacesMessage.SEVERITY_WARN, ivs[0].getMessage());
| FacesContext.getCurrentInstance().addMessage(property, /* TODO */
| message);
| FacesContext.getCurrentInstance().renderResponse();
| }
| }
|
| /**
| * Did a validation failure occur during a call to validate()?
| */
| protected boolean isValidationFailure() {
| return this.validationFailed;
| }
|
| protected FacesContext getFacesContext() {
| return this.facesContext;
| }
|
| protected String getConversationId() {
| return this.conversationId;
| }
|
| /**
| * Evaluate (get) a value binding
| */
| protected Object getValue(final String valueExpression) {
| return this.application.createValueBinding(valueExpression)
| .getValue(this.facesContext);
| }
|
| /**
| * Set a value binding
| */
| protected void setValue(final String valueExpression, final Object value) {
| this.application.createValueBinding(valueExpression).setValue(
| this.facesContext, value);
| }
|
| /**
| * Validate the value against model-based constraints return true if the
| * value is valid
| */
| protected boolean validateValue(final String valueExpression,
| final Object value) {
| final InvalidValue[] ivs = Expressions.instance().validate(
| valueExpression, value);
| if (ivs.length > 0) {
| this.validationFailed = true;
| this.facesContext.addMessage(null, FacesMessages
| .createFacesMessage(FacesMessage.SEVERITY_WARN, ivs[0]
| .getMessage()));
| return false;
| } else {
| return true;
| }
| }
|
| /**
| * Call a method binding
| */
| protected Object invokeMethod(final String methodExpression) {
| return new ActionParamMethodBinding(this.application,
| methodExpression).invoke(this.facesContext, null);
| }
|
| /**
| * @return the conversation id
| * @throws Exception
| * to fail the test
| */
| public String run() throws Exception {
| final HttpServletRequest request = new MockHttpServletRequest(
| AbstractSeamTest.this.session, this.getPrincipalName(),
| this.getPrincipalRoles(), this.getCookies().toArray(
| new Cookie[] {}));
| AbstractSeamTest.this.externalContext = new MockExternalContext(
| AbstractSeamTest.this.servletContext, request);
| this.application = new SeamApplication11(
| AbstractSeamTest.this.application);
| this.facesContext = new MockFacesContext(
| AbstractSeamTest.this.externalContext, this.application);
| this.facesContext.setCurrent();
|
| this.beforeRequest();
|
| AbstractSeamTest.this.phases.beforePhase(new PhaseEvent(
| this.facesContext, PhaseId.RESTORE_VIEW,
| MockLifecycle.INSTANCE));
|
| final UIViewRoot viewRoot = this.facesContext.getApplication()
| .getViewHandler().createView(this.facesContext,
| this.getViewId());
| this.facesContext.setViewRoot(viewRoot);
| final Map restoredViewRootAttributes = this.facesContext
| .getViewRoot().getAttributes();
| if (this.conversationId != null) {
| if (this.isGetRequest()) {
| AbstractSeamTest.this.setParameter(Manager.instance()
| .getConversationIdParameter(), this.conversationId);
| // TODO: what about conversationIsLongRunning????
| } else {
| if (AbstractSeamTest.this.conversationViewRootAttributes
| .containsKey(this.conversationId)) {
| // should really only do this if the view id matches
| // (not really possible to implement)
| final Map state = AbstractSeamTest.this.conversationViewRootAttributes
| .get(this.conversationId);
| restoredViewRootAttributes.putAll(state);
| }
| }
| }
| if (!this.isGetRequest()) {
| restoredViewRootAttributes
| .putAll(AbstractSeamTest.this.pageParameters);
| }
|
| this.updateConversationId();
|
| AbstractSeamTest.this.phases.afterPhase(new PhaseEvent(
| this.facesContext, PhaseId.RESTORE_VIEW,
| MockLifecycle.INSTANCE));
|
| if (!this.isGetRequest() && !this.skipToRender()) {
|
| AbstractSeamTest.this.phases.beforePhase(new PhaseEvent(
| this.facesContext, PhaseId.APPLY_REQUEST_VALUES,
| MockLifecycle.INSTANCE));
|
| this.applyRequestValues();
|
| this.updateConversationId();
|
| AbstractSeamTest.this.phases.afterPhase(new PhaseEvent(
| this.facesContext, PhaseId.APPLY_REQUEST_VALUES,
| MockLifecycle.INSTANCE));
|
| if (!this.skipToRender()) {
|
| AbstractSeamTest.this.phases.beforePhase(new PhaseEvent(
| this.facesContext, PhaseId.PROCESS_VALIDATIONS,
| MockLifecycle.INSTANCE));
|
| this.processValidations();
|
| this.updateConversationId();
|
| AbstractSeamTest.this.phases.afterPhase(new PhaseEvent(
| this.facesContext, PhaseId.PROCESS_VALIDATIONS,
| MockLifecycle.INSTANCE));
|
| if (!this.skipToRender()) {
|
| AbstractSeamTest.this.phases
| .beforePhase(new PhaseEvent(this.facesContext,
| PhaseId.UPDATE_MODEL_VALUES,
| MockLifecycle.INSTANCE));
|
| this.updateModelValues();
|
| this.updateConversationId();
|
| AbstractSeamTest.this.phases.afterPhase(new PhaseEvent(
| this.facesContext, PhaseId.UPDATE_MODEL_VALUES,
| MockLifecycle.INSTANCE));
|
| if (!this.skipToRender()) {
|
| AbstractSeamTest.this.phases
| .beforePhase(new PhaseEvent(
| this.facesContext,
| PhaseId.INVOKE_APPLICATION,
| MockLifecycle.INSTANCE));
|
| this.invokeApplicationBegun = true;
|
| this.invokeApplication();
|
| this.invokeApplicationComplete = true;
|
| final String outcome = this
| .getInvokeApplicationOutcome();
| this.facesContext.getApplication()
| .getNavigationHandler().handleNavigation(
| this.facesContext, null, outcome);
|
| this.viewId = this.getRenderedViewId();
|
| this.updateConversationId();
|
| AbstractSeamTest.this.phases
| .afterPhase(new PhaseEvent(
| this.facesContext,
| PhaseId.INVOKE_APPLICATION,
| MockLifecycle.INSTANCE));
|
| }
|
| }
|
| }
|
| }
|
| if (this.skipRender()) {
| // we really should look at redirect parameters here!
| } else {
|
| AbstractSeamTest.this.phases.beforePhase(new PhaseEvent(
| this.facesContext, PhaseId.RENDER_RESPONSE,
| MockLifecycle.INSTANCE));
|
| this.renderResponseBegun = true;
|
| this.renderResponse();
|
| this.renderResponseComplete = true;
|
| this.facesContext.getApplication().getStateManager()
| .saveSerializedView(this.facesContext);
|
| this.updateConversationId();
|
| AbstractSeamTest.this.phases.afterPhase(new PhaseEvent(
| this.facesContext, PhaseId.RENDER_RESPONSE,
| MockLifecycle.INSTANCE));
|
| final Map renderedViewRootAttributes = this.facesContext
| .getViewRoot().getAttributes();
| if (renderedViewRootAttributes != null) {
| final Map conversationState = new HashMap();
| conversationState.putAll(renderedViewRootAttributes);
| AbstractSeamTest.this.conversationViewRootAttributes.put(
| this.conversationId, conversationState);
| }
|
| }
|
| this.afterRequest();
|
| return this.conversationId;
| }
|
| private void updateConversationId() {
| this.conversationId = Manager.instance().getCurrentConversationId();
| }
|
| private boolean skipRender() {
| return FacesContext.getCurrentInstance().getResponseComplete();
| }
|
| private boolean skipToRender() {
| return FacesContext.getCurrentInstance().getRenderResponse()
| || FacesContext.getCurrentInstance().getResponseComplete();
| }
|
| protected boolean isInvokeApplicationBegun() {
| return this.invokeApplicationBegun;
| }
|
| protected boolean isInvokeApplicationComplete() {
| return this.invokeApplicationComplete;
| }
|
| protected boolean isRenderResponseBegun() {
| return this.renderResponseBegun;
| }
|
| protected boolean isRenderResponseComplete() {
| return this.renderResponseComplete;
| }
|
| }
|
| public class NonFacesRequest extends Request {
| public NonFacesRequest() {
| }
|
| /**
| * @param viewId
| * the view id to be rendered
| */
| public NonFacesRequest(final String viewId) {
| this.setViewId(viewId);
| }
|
| /**
| * @param viewId
| * the view id to be rendered
| * @param conversationId
| * the conversation id
| */
| public NonFacesRequest(final String viewId, final String conversationId) {
| super(conversationId);
| this.setViewId(viewId);
| }
|
| @Override
| protected final boolean isGetRequest() {
| return true;
| }
|
| @Override
| protected final void applyRequestValues() throws Exception {
| throw new UnsupportedOperationException();
| }
|
| @Override
| protected final void processValidations() throws Exception {
| throw new UnsupportedOperationException();
| }
|
| @Override
| protected final void updateModelValues() throws Exception {
| throw new UnsupportedOperationException();
| }
|
| }
|
| public class FacesRequest extends Request {
|
| public FacesRequest() {
| }
|
| /**
| * @param viewId
| * the view id of the form that was submitted
| */
| public FacesRequest(final String viewId) {
| this.setViewId(viewId);
| }
|
| /**
| * @param viewId
| * the view id of the form that was submitted
| * @param conversationId
| * the conversation id
| */
| public FacesRequest(final String viewId, final String conversationId) {
| super(conversationId);
| this.setViewId(viewId);
| }
|
| @Override
| protected final boolean isGetRequest() {
| return false;
| }
|
| }
|
| @Before
| public void begin() {
| this.session = new MockHttpSession(this.servletContext);
| }
|
| @After
| public void end() {
| if (Contexts.isEventContextActive()) {
| Lifecycle.endRequest(this.externalContext);
| }
| Lifecycle.endSession(this.servletContext, new ServletSessionImpl(
| this.session));
| this.session = null;
| }
|
| /**
| * Create a SeamPhaseListener by default. Override to use one of the other
| * standard Seam phase listeners.
| */
| protected static AbstractSeamPhaseListener createPhaseListener() {
| return new SeamPhaseListener();
| }
|
| @BeforeClass
| public static void init() throws Exception {
| application = new MockApplication();
| application.setStateManager(new SeamStateManager(application
| .getStateManager()));
| application.setNavigationHandler(new SeamNavigationHandler(application
| .getNavigationHandler()));
| // don't need a SeamVariableResolver, because we don't test the view
| phases = createPhaseListener();
|
| servletContext = new MockServletContext();
| initServletContext(servletContext.getInitParameters());
| Lifecycle.setServletContext(servletContext);
| new Initialization(servletContext).create().init();
|
| conversationViewRootAttributes = new HashMap<String, Map>();
| }
|
| @AfterClass
| public static void cleanup() throws Exception {
| if (servletContext != null)
| Lifecycle.endApplication(servletContext);
| externalContext = null;
| conversationViewRootAttributes = null;
| }
|
| /**
| * Override to set up any servlet context attributes.
| */
| public static void initServletContext(final Map initParams) {
| }
|
| protected InitialContext getInitialContext() throws NamingException {
| return Naming.getInitialContext();
| }
|
| protected UserTransaction getUserTransaction() throws NamingException {
| return Transactions.getUserTransaction();
| }
|
| /**
| * Get the value of an object field, by reflection.
| */
| protected Object getField(final Object object, final String fieldName) {
| final Field field = Reflections.getField(object.getClass(), fieldName);
| if (!field.isAccessible()) {
| field.setAccessible(true);
| }
| return Reflections.getAndWrap(field, object);
| }
|
| /**
| * Set the value of an object field, by reflection.
| */
| protected void setField(final Object object, final String fieldName,
| final Object value) {
| final Field field = Reflections.getField(object.getClass(), fieldName);
| if (!field.isAccessible()) {
| field.setAccessible(true);
| }
| Reflections.setAndWrap(field, object, value);
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056913#4056913
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056913
18Â years, 10Â months
[JBoss and NetBeans] - Re: EJB Deploynment with JBoss and use of annotations fails
by aneta
Hello,
ths is ok as I specified the hibernate-dialect correctly. Jboss deployed the application and I have a table "book" in my mysql. Now I still can enter or manipulate data.
This is my JBoss-Stacktrace:
16:22:53,535 INFO [Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0
-8080
16:22:53,691 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
16:22:53,707 INFO [JkMain] Jk running ID=0 time=0/47 config=null
16:22:53,785 INFO [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Bran
ch_4_0 date=200610162339)] Started in 35s:531ms
16:23:04,379 INFO [Ejb3Deployment] EJB3 deployment time took: 656
16:23:04,379 INFO [JmxKernelAbstraction] installing MBean: persistence.units:ja
r=FirstEJB3Tutorial.jar,unitName=FirstEjb3Tutorial with dependencies:
16:23:04,379 INFO [JmxKernelAbstraction] jboss.jca:name=ejb3ExampleDS,ser
vice=DataSourceBinding
16:23:04,441 INFO [Version] Hibernate EntityManager 3.2.0.CR2
16:23:04,457 INFO [Version] Hibernate Annotations 3.2.0.CR2
16:23:04,473 INFO [Environment] Hibernate 3.2.0.ga
16:23:04,488 INFO [Environment] hibernate.properties not found
16:23:04,488 INFO [Environment] Bytecode provider name : javassist
16:23:04,488 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
16:23:04,660 INFO [Ejb3Configuration] found EJB3 Entity bean: de.laliluna.libra
ry.Book
16:23:04,660 WARN [Ejb3Configuration] Persistence provider caller does not impl
ements the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is n
ull.
16:23:04,754 INFO [Configuration] Reading mappings from resource: META-INF/orm.
xml
16:23:04,769 INFO [Ejb3Configuration] [PersistenceUnit: FirstEjb3Tutorial] no M
ETA-INF/orm.xml found
16:23:04,848 INFO [AnnotationBinder] Binding entity from annotated class: de.la
liluna.library.Book
16:23:04,926 INFO [EntityBinder] Bind entity de.laliluna.library.Book on table
book
16:23:05,191 INFO [ConnectionProviderFactory] Initializing connection provider:
org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
16:23:05,207 INFO [InjectedDataSourceConnectionProvider] Using provided datasou
rce
16:23:05,519 INFO [SettingsFactory] RDBMS: MySQL, version: 4.1.18-nt
16:23:05,519 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version:
mysql-connector-java-5.0.6 ( $Date: 2007-03-09 22:13:57 +0100 (Fri, 09 Mar 2007
) $, $Revision: 6341 $ )
16:23:05,551 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
16:23:05,551 INFO [TransactionFactoryFactory] Transaction strategy: org.hiberna
te.ejb.transaction.JoinableCMTTransactionFactory
16:23:05,551 INFO [TransactionManagerLookupFactory] instantiating TransactionMa
nagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
16:23:05,566 INFO [TransactionManagerLookupFactory] instantiated TransactionMan
agerLookup
16:23:05,566 INFO [SettingsFactory] Automatic flush during beforeCompletion():
disabled
16:23:05,566 INFO [SettingsFactory] Automatic session close at end of transacti
on: disabled
16:23:05,566 INFO [SettingsFactory] JDBC batch size: 15
16:23:05,566 INFO [SettingsFactory] JDBC batch updates for versioned data: disa
bled
16:23:05,566 INFO [SettingsFactory] Scrollable result sets: enabled
16:23:05,566 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
16:23:05,566 INFO [SettingsFactory] Connection release mode: auto
16:23:05,566 INFO [SettingsFactory] Maximum outer join fetch depth: 2
16:23:05,566 INFO [SettingsFactory] Default batch fetch size: 1
16:23:05,566 INFO [SettingsFactory] Generate SQL with comments: disabled
16:23:05,566 INFO [SettingsFactory] Order SQL updates by primary key: disabled
16:23:05,566 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.AST
QueryTranslatorFactory
16:23:05,566 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
16:23:05,566 INFO [SettingsFactory] Query language substitutions: {}
16:23:05,566 INFO [SettingsFactory] JPA-QL strict compliance: enabled
16:23:05,566 INFO [SettingsFactory] Second-level cache: enabled
16:23:05,566 INFO [SettingsFactory] Query cache: disabled
16:23:05,566 INFO [SettingsFactory] Cache provider: org.hibernate.cache.Hashtab
leCacheProvider
16:23:05,582 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
16:23:05,582 INFO [SettingsFactory] Structured second-level cache entries: disa
bled
16:23:05,582 INFO [SettingsFactory] Statistics: disabled
16:23:05,582 INFO [SettingsFactory] Deleted entity synthetic identifier rollbac
k: disabled
16:23:05,582 INFO [SettingsFactory] Default entity-mode: pojo
16:23:05,644 INFO [SessionFactoryImpl] building session factory
16:23:06,332 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no
JNDI name configured
16:23:06,348 INFO [SchemaExport] Running hbm2ddl schema export
16:23:06,348 INFO [SchemaExport] exporting generated schema to database
16:23:06,379 WARN [JDBCExceptionReporter] SQL Warning: 1051, SQLState: 42S02
16:23:06,379 WARN [JDBCExceptionReporter] Unknown table 'book'
16:23:06,441 WARN [JDBCExceptionReporter] SQL Warning: 1051, SQLState: 42S02
16:23:06,441 WARN [JDBCExceptionReporter] Unknown table 'book'
16:23:06,441 INFO [SchemaExport] schema export complete
16:23:06,473 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.fa
ctory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.p
kgs=org.jboss.naming:org.jnp.interfaces}
16:23:06,535 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=First
EJB3Tutorial.jar,name=BookTestBean,service=EJB3 with dependencies:
16:23:06,535 INFO [JmxKernelAbstraction] persistence.units:jar=FirstEJB3T
utorial.jar,unitName=FirstEjb3Tutorial
16:23:06,941 INFO [EJBContainer] STARTED EJB: de.laliluna.library.BookTestBean
ejbName: BookTestBean
16:23:07,051 INFO [EJB3Deployer] Deployed: file:/C:/Programme/JBoss/jboss-4.0.5
.GA/server/default/deploy/FirstEJB3Tutorial.jar
Why is book unknown as it exists in mysql?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056912#4056912
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056912
18Â years, 10Â months