From users-return-5954-archive-asf-public=cust-asf.ponee.io@isis.apache.org Thu Feb 15 12:49:09 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id DCCEB18064A for ; Thu, 15 Feb 2018 12:49:08 +0100 (CET) Received: (qmail 55368 invoked by uid 500); 15 Feb 2018 11:49:07 -0000 Mailing-List: contact users-help@isis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@isis.apache.org Delivered-To: mailing list users@isis.apache.org Received: (qmail 55356 invoked by uid 99); 15 Feb 2018 11:49:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Feb 2018 11:49:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id C2D9D180493 for ; Thu, 15 Feb 2018 11:49:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.879 X-Spam-Level: * X-Spam-Status: No, score=1.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id zfMZLQxacy7w for ; Thu, 15 Feb 2018 11:49:02 +0000 (UTC) Received: from mail-ua0-f173.google.com (mail-ua0-f173.google.com [209.85.217.173]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id B62735F169 for ; Thu, 15 Feb 2018 11:49:01 +0000 (UTC) Received: by mail-ua0-f173.google.com with SMTP id r4so15639696uak.6 for ; Thu, 15 Feb 2018 03:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=YNP+UiCgza58kgyMDbGPxIKbFVPtFN5+aM8FYEppyj0=; b=b5Gn+dhjDVzA9QuGQPPoLpSdntf5+fhtRWAKrrV6l84b1ixtKxrr1t6NvKidX92XJH jQIvB0AniRXcGrCtz6C1MSmciaPK5FvV1fsa25pheRfqv30E4YAh2u4YlkAe44zrQ7oD s5HS7ea+kj/fz5hhJCCR7yRltnIpqn8qijZGNKCE86aPPj0fHgMuoaKDa1eE/+aixayZ 32akACOEkMJ17n6t54ILVBM2+4lZCJy5jgfLGnr59Si5z0OaF8tvW9q11ae7tJetNqYG 0bdoxpR22ftSdUYVPZB9DfMZi/K3vWfa0461mVSJcbTx2+3N9ERa8840gUEt9KXZVwrX 1uag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=YNP+UiCgza58kgyMDbGPxIKbFVPtFN5+aM8FYEppyj0=; b=qojj5rO2wF3MkM4bTTE8XQRbNRQCjD4L8njhpihxwKPRJh7kxiF+/T60MJJ1Lfdmzl MP26zLQmof11CK6vWOdbBzCDQpnXVAXQaEKxuYLtoViXbUmuVrZVxf4OuMuS1YWGBbTg x2twdGy24GMc7weYcUB7p1Hr0E0Ic5bSyv42Q/fHayzcyqX/YFUHAWUFF0nAJZOXVUQP /uIa9oQnwKyqDrM+WFqnSjip+vduY4QLA/nAxGGn9KK8p2FI7CeWp4anJg6LcvzrW0uJ VvQd1qr0kHfxZ1796JZV2esSzcrs5Qb29T+g/IxfH0ULHMqxF0De9hYplN9NSdm0Q14o +MCA== X-Gm-Message-State: APf1xPBiwUY1B0tdnBQWaK2LD5SIH6U0QgENL9tY0v4ay0ytu0xHclIh zek3RvlPBK9DwqhEL4e6G1fSCIGSTeHsEYsKGp7Dkw== X-Google-Smtp-Source: AH8x2247ConIsPTZ7CrCnp+rCFAacCbhh7U5U+P2LFk4Wk5iz4GI90Huzz4sdK3//L34PB7svZGrsW47Cgxys8Vj2Bk= X-Received: by 10.176.9.224 with SMTP id e32mr1865504uah.186.1518695340503; Thu, 15 Feb 2018 03:49:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.83.212 with HTTP; Thu, 15 Feb 2018 03:49:00 -0800 (PST) In-Reply-To: References: From: Smitha N Date: Thu, 15 Feb 2018 12:49:00 +0100 Message-ID: Subject: Re: Using database Views To: users@isis.apache.org Content-Type: multipart/alternative; boundary="f403043ee33c4af65705653ed0b0" --f403043ee33c4af65705653ed0b0 Content-Type: text/plain; charset="UTF-8" Hello Steve, Thanks for the input. I tried creating viewModel in similar fashion. But I face issues when I try to run the integration tests for this class. I get issues creating the view with the below mentioned errors: Error thrown executing CREATE VIEW `usersforportal` AS SELECT `users`.id AS id,`users`.helenaam AS helenaam,`users`.email AS email FROM `users` WHERE `users`.actief = 1 AND `users`.bedrijf_id = 1 AND `users`.email is not null : unexpected token: required: AS java.sql.SQLSyntaxErrorException: unexpected token: required: AS at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source) When I try the same syntax on MYSQL workbench , it works fine and there are no errors. Somehow these issues occur while running the integration tests with in-memory database. Any help is much appreciated. Regards Smitha On Wed, Feb 14, 2018 at 10:17 PM, Stephen Cameron < steve.cameron.62@gmail.com> wrote: > Hi, > > Using a DataNucleus capability rather than an Apache Isis one. > > http://www.datanucleus.org/products/accessplatform_3_1/rdbms/views.html > > You can use annotations in your class instead of a jdo config file, I > copied examples from Estatio to get started. > > But here is one I've created: > https://github.com/Stephen-Cameron-Data-Services/isis- > chats/blob/master/reports/src/main/java/au/com/scds/chats/dom/report/view/ > ActivityAttendanceSummary.java > > The class can be seen by making your view class a ViewModel. > > I don't think you can use persistable views, may be wrong on that. > > I've had a problem with views, that DN tries to create them before the > underlying tables are created, never resolved that but I should. > > If I were to start afresh I'd not use them unless absolutely necessary for > performance, instead use queries on my domain objects and write code, then > you have easier refactoring. > > Steve > > > > On Thu, Feb 15, 2018 at 2:26 AM, Smitha N wrote: > > > Hi, > > > > In our application, there is a need to use database views and I was > > wondering what is the best way to implement it using the framework. > > > > How do we map the database view fields to the Object? Can we use > ViewModels > > with persistanceCapability and refer to the view? > > > > If above scenario is valid, how do we make such scenarios work for > > integration testing? > > If not please advise on how to use database views. > > > > Regards > > Smitha > > > --f403043ee33c4af65705653ed0b0--