HI Justin,
You should be able to get a fix for your problem now by
downloading the latest nightly build.
Cheers,
Guy
On 17/11/2012 8:39 PM, Developer Account wrote:
Hi Guy,
i filed a bug ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=394524)
i can't use EMF level multitenancy because there is gonna be
quite a lot of users creating a new EMF everytime the system
talks to the DB and EMF creation is quite expensive in
performance.
-Justin
On 12-11-16 11:25 AM, Guy Pelletier wrote:
Hi Justin,
This looks to be a bug, can you enter one please?
It would appear that while processing the queries
relationships, the mapping for report is being retrieved from
an uninitialized descriptor (when it should be asking for it
from the initialized EM level multitenant one). The only
workaround right now would be to use EMF level multitenancy.
Cheers,
Guy
On 16/11/2012 1:56 PM, Justin Joe wrote:
Hi Tom,
when i comment out these two lines
from CreatedReport entity :
@Multitenant(MultitenantType.TABLE_PER_TENANT)
@TenantTableDiscriminator(type=
TenantTableDiscriminatorType.SCHEMA, contextProperty=
"eclipselink.tenant-id")
i get this error:
remote failure: Error occurred during deployment:
Exception while preparing the app : Exception
[EclipseLink-28019] (Eclipse Persistence Services -
2.5.0.v20121110-3770ab2):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit
[multi-tenant-pu] failed. Close all factories for this
PersistenceUnit.
Internal Exception: Exception [EclipseLink-0] (Eclipse
Persistence Services - 2.5.0.v20121110-3770ab2):
org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [SELECT
c FROM CreatedReport c where c.report.reportType.id =
:typeId].
[64, 86] The state field path 'c.report.reportType.id'
cannot be resolved to a valid type.. Please see
server.log for more details.
Command deploy failed.
-Justin
On 11/16/2012 5:25 AM, Tom Ware wrote:
Does
the same query work without the
@Multitenant(MultitenantType.TABLE_PER_TENANT) annotations?
On 16/11/2012 3:53 AM, Developer Account wrote:
Hi Tom,
i tried adding the new property but nothing changed
here is my persistence-unit
/<persistence-unit name="multi-tenant-pu"
transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>...CreatedReport</class>
<class>..Report</class>
.....
<properties>//
<property name="eclipselink.logging.file"
value="/tmp/eclipselink.log"/>
<property name="eclipselink.logging.level"
value="ALL"/>
<property name="eclipselink.jpql.parser"
value="org.eclipse.persistence.queries.ANTLRQueryBuilder"
/>
<property name="javax.persistence.jdbc.driver"
value="org.postgresql.Driver"></property>
<property name="javax.persistence.jdbc.url"
value="jdbc:postgresql://localhost:5432/DB"></property>
<property name="javax.persistence.jdbc.user"
value="postgres"></property>
<property name="javax.persistence.jdbc.password"
value="xxx"></property>
</properties>
</persistence-unit>/
-Justin
On 12-11-15 05:06 AM, Tom Ware wrote:
Could you try to add the following
persistence unit property:
eclipselink.jpql.parser=org.eclipse.persistence.queries.ANTLRQueryBuilder
On 15/11/2012 3:54 AM, Developer Account wrote:
Hi Tom,
/[#|2012-11-13T22:32:19.945-0800|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=21;_ThreadName=Thread-2;|Exception
[EclipseLink-6015] (Eclipse Persistence Services -
2.5.0.v20121110-3770ab2):
org.eclipse.persistence.exceptions.QueryException
Exception Description: *Invalid query key [report] in
_expression_*.
Query:
ReadAllQuery(name="CreatedReport.findAllByTypeId"
referenceClass=CreatedReport jpql="SELECT c FROM
CreatedReport c where
c.report.reportType.id = :typeId")|#]
[#|2012-11-13T22:32:19.945-0800|INFO|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=21;_ThreadName=Thread-2;|PWC1412:
WebModule[null] ServletContext.log():null|#]
/
these are the only other stack traces, i thought it is
a mapping issue.
it was working when i was using *sun-glassfish 3.0.1*
and *eclipselink 2.3* with
a JTA persistence-unit,
all i changed was upgrading sun-glassfish, eclipselink
and changing the
transaction-type to RESOURCE_LOCAL for multitenancy
features so the transactions
are managed by the application not the container
anymore and
I am using *EM level Table Per Tenant Multitenancy*
here is how i create the EntityManager
/private EntityManager getEntitymanager() {
HashMap properties = new HashMap();
properties.put(EntityManagerProperties.*MULTITENANT_PROPERTY_DEFAULT*,
"tenant1");
EntityManagerFactory emf =
PersistenceManagerEMF.getInstance().getEntityManagerFactory();
//
Persistence.createEntityManagerFactory("multi-tenant-pu");
return emf.createEntityManager(properties);
}/
i thought there was some changes around parsing the
@NamedQueries lately because
i think it wouldn't be deployed if the problem was
sun-glassfish.
I get the error when this line is being executed
/Query query =
em.createNamedQuery("CreatedReport.findAllByTypeId");
/
-Justin
On 12-11-14 04:24 AM, Tom Ware wrote:
Hi,
Is there more to the stack trace? I don't see any
EclipseLink classes in
the stack. In the absence of
org.eclipse.persistence classes in the stack, I
think it is more likely the issue is somewhere else.
-Tom
On 14/11/2012 2:13 AM, Developer Account wrote:
Hi guys,
I am using the latest *eclipselink* nightly build
(2.5.0 ...)
and am getting a *NullPointerException* when i try
to run a @*NamedQuery*
which
joins more than one table
here is the question:
*_/SELECT c FROM CreatedReport c where
c.report.reportType.id = :typeId/_**__*
and here are the POJOs
/@Entity
@Table(name = "created_report")
@Multitenant(MultitenantType.TABLE_PER_TENANT)
@TenantTableDiscriminator(type=
TenantTableDiscriminatorType.SCHEMA,
contextProperty= "eclipselink.tenant-id")
@NamedQueries({
@NamedQuery(name =
"///CreatedReport/.findAllByTypeId",
query = "SELECT c FROM ///CreatedReport/
c where
c.report.reportType.id
= :typeId"),
})
public class *CreatedReport* implements
Serializable {
private static final long serialVersionUID =
1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "id")
private Integer *id*;
@Basic(optional = false)
@Column(name = "date")
@Temporal(TemporalType.TIMESTAMP)
private Date *date*;
@JoinColumn(name = "report_id",
referencedColumnName = "id")
@ManyToOne(optional = false)
private Report *report*;
... getters and setters
}
@Entity
@Table(name = "report")
@Multitenant(MultitenantType.TABLE_PER_TENANT)
@TenantTableDiscriminator(type=
TenantTableDiscriminatorType.SCHEMA,
contextProperty= "eclipselink.tenant-id")
public class *Report* implements Serializable {
private static final long serialVersionUID =
1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "id")
private Integer *id*;
@Column(name = "name")
private String *name*;
@XmlTransient
@OneToMany(cascade = CascadeType.ALL,
mappedBy = "report")
private List<CreatedReport>
*createdReports*;
@XmlTransient
@JoinColumn(name = "report_type_id",
referencedColumnName = "id")
@ManyToOne(optional = false)
private ReportType *reportType*;
... getters and setters
}////
@Entity
@Table(name = "report_type")
@Multitenant(MultitenantType.TABLE_PER_TENANT)
@TenantTableDiscriminator(type=
TenantTableDiscriminatorType.SCHEMA,
contextProperty= "eclipselink.tenant-id")
public class *ReportType* implements Serializable
{
private static final long serialVersionUID =
1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "id")
private Integer *id*;
@Basic(optional = false)
@Column(name = "name")
private String *name*;
@OneToMany(cascade = CascadeType.ALL,
mappedBy = "reportType")
private List<Report>
*reportCollection*;
@OneToMany(cascade = CascadeType.ALL,
mappedBy = "reportType")
private List<ReportArgument>
*reportArguments*;
... getters and setters
}
/and here is the EJB /call//
public List<CreatedReport>
findAllByTypeId(Integer typeId) {
List<///CreatedReport/>
reportsByTypeId = null;
try {
em = getEntitymanager(); // create
the tenant based EM
tx = em.getTransaction();
tx.begin();
Query query =
em.createNamedQuery("//*/CreatedReport/**.findAllByTypeId*");
query.setParameter("typeId", typeId);
reportsByTypeId =
(List<///CreatedReport/>)
query.getResultList();
} catch(Exception ex) {
tx.rollback();
System.out.println(ex.toString());
} finally {
if (em != null &&
em.isOpen()) {
em.close();
}
}
return reportsByTypeId;
}
/when it is trying to create the query, it gets
this error :/
java.lang.NullPointerException
at
java.util.Collections.reverse(Collections.java:381)
at
com.sun.rave.web.ui.appbase.servlet.LifecycleListener.fireInit(LifecycleListener.java:633)
at
com.sun.rave.web.ui.appbase.servlet.LifecycleListener.attributeAdded(LifecycleListener.java:483)
at
org.apache.catalina.connector.Request.setAttribute(Request.java:1716)
at
org.apache.catalina.connector.RequestFacade.setAttribute(RequestFacade.java:570)
at
javax.servlet.ServletRequestWrapper.setAttribute(ServletRequestWrapper.java:283)
at
com.sun.faces.context.RequestMap.put(RequestMap.java:101)
at
com.sun.faces.context.RequestMap.put(RequestMap.java:54)
at
com.sun.faces.mgbean.BeanManager$ScopeManager$RequestScopeHandler.handle(BeanManager.java:527)
at
com.sun.faces.mgbean.BeanManager$ScopeManager.pushToScope(BeanManager.java:458)
at
com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:410)
at
com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
at
com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
at
com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)
at
com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at
com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at
com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:103)
at
com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
at
com.sun.faces.application.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:113)
at
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.pageBean(ViewHandlerImpl.java:710)
at
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.pageBean(ViewHandlerImpl.java:685)
at
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:284)
at
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at
com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.render(PartialTraversalLifecycle.java:106)
at
javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at
com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:267)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at
org.jasig.cas.client.util.AssertionThreadLocalFilter.doFilter(AssertionThreadLocalFilter.java:40)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at
org.jasig.cas.client.util.HttpServletRequestWrapperFilter.doFilter(HttpServletRequestWrapperFilter.java:50)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at
org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:167)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at
org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:104)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at
com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:679)
/could this be a bug in eclipselink or am i
missing something ?/
/thanks in advance
Justin/
/
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--

Guy Pelletier
ORACLE Canada, 45 O'Connor Street Suite 400 Ottawa,
Ontario Canada K1P 1A4
Oracle is committed
to developing practices and products that help protect the
environment
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--

Guy Pelletier
ORACLE Canada,
45 O'Connor Street
Suite 400
Ottawa, Ontario
Canada K1P 1A4
Oracle is committed to developing
practices and products that help protect the environment
|