Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] TENANT_PER_TABLE Problem. Can't compile Named Query.

The transaction should be implied. Interesting you point that out though, I
just noticed there is no mention of a eclipselink session in the stack
trace... hmmm.


Here's my existing code:

/**
 * Session Bean implementation class TheHubServiceBean.
 */
@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public class TheHubServiceBean implements TheHubService {
	private static final long serialVersionUID = 1L;

	@Inject
	private Logger log;

	@PersistenceContext
	private EntityManager em;

	/**
	 * {@inheritDoc}
	 */
	@Override
	public List<Item> listActiveItems() {
		em.setProperty("eclipselink.session-name", "cust_tables");
		em.setProperty("tenant_schema_name", "cust_tables");
		log.debug("listActiveItems()");
		// TypedQuery<Item> query = em.createNamedQuery("listActiveItems",
Item.class);
		TypedQuery<Item> query =
			em.createQuery("select items from Item items where items.status =
fm.thehub.Status.ACTIVE", Item.class);
		List<Item> results = query.getResultList();
		log.debug("listActiveItems() found {} items", results.size());
		return results;
	}
}

This "em.getTransaction().begin();" results in a non-eclipselink error. Let
me debug that...



--
View this message in context: http://eclipse.1072660.n5.nabble.com/TENANT-PER-TABLE-Problem-Can-t-compile-Named-Query-tp157573p157580.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.


Back to the top