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.

In AbstractSession updateTablePerTenantDescriptors(). This method should be called after you call:
em.setProperty("customer_schema", "cust_tables");
Once completed, in theory all your descriptors and queries should be cloned and initialized after this call. Somewhere in here is where I would suspect the bug exists.

Cheers,
Guy


On 06/02/2013 3:11 PM, exabrial wrote:
descriptors and queries are cloned per ClientSession
See that's the thing, I don't think I'm getting a ClientSession created.
Checkout my stack traces, there is no mention of a session anywhere in it.
If you have a suggestion where to set a breakpoint to watch for a
ClientSession being initialized, let me know.

Have you tested straight up CRUD operations on the table per tenant
multitenant entities? 
Yep, most other things work, as long as the NamedQuery is commented out. For
example, here's merge:

@Entity
@Table(name = "items")
//@NamedQuery(name = "listActiveItems", query = "select items from Item
items where items.status = fm.thehub.Status.ACTIVE")
@Multitenant(MultitenantType.TABLE_PER_TENANT)
@TenantTableDiscriminator(contextProperty = "customer_schema", type =
TenantTableDiscriminatorType.SCHEMA)
public class Item implements Serializable {
.....
}


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

	@Inject
	private Logger log;

	@PersistenceContext
	private EntityManager em;

	@Override
	public Item saveItem(Item item) {
		em.setProperty("customer_schema", "cust_tables");
		log.debug("createItem() item:{}", item);
		item = em.merge(item);
		log.debug("createItem() item.id:{}", item.id);
		return item;
	}
}




--
View this message in context: http://eclipse.1072660.n5.nabble.com/TENANT-PER-TABLE-Problem-Can-t-compile-Named-Query-tp157573p157596.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

--

Oracle
Guy Pelletier

ORACLE Canada, 45 O'Connor Street Suite 400 Ottawa, Ontario Canada K1P 1A4

Green
            Oracle Oracle is committed to developing practices and products that help protect the environment


Back to the top