Yeah, IIRC what happened was that it was trying to read tables from the schema 
with the user's name (assuming it was the default) while when it actually 
created them they went into the actual default, PUBLIC. I think this resulted 
in Schemifier trying to create tables that existed maybe.
So the real fix was setting the H2 DriverType default schema to PUBLIC, as we 
realized only later.


-----Original Message-----
From: David Pollak <feeder.of.the.be...@gmail.com>
Sent: Tuesday, November 24, 2009 9:32 AM
To: liftweb@googlegroups.com
Subject: Re: [Lift] Re: overriding ConnectionManager.newSuperConnection



On Tue, Nov 24, 2009 at 6:24 AM, opyate <opy...@gmail.com> wrote:
Hi David,

 I did work around this by putting the schemas in my search path.
 Edit postgresql.conf and add the following:
 search_path = '"$user",public,schema1,schema2,schemaN'

 As for this being a bug... did you intend for Mapper to support
 schemas on the CRUD side?

The support for schemas in schemifier was a special-case fix for, if I remember 
correctly, something relating to H2 and the way H2 user names are related to 
something.

 I think the short answer is that we're not going to explicitly support schemas 
in Mapper.  If you need a more complete ORM, please use JPA.

Sorry.
 
If so, I'd be happy to create a repro.
 BUT it can quite easily be reproduced by taking an existing project
 and moving an existing table into a schema:

 $ psql yourdb
 yourdb=# create schema someschema;
 CREATE SCHEMA
 yourdb=# alter table user set schema someschema;
 ALTER TABLE

 Now relaunch your app, and you'll see some issues with the user table.
 Previously I had to alter my User companion object like so:

 override def dbTableName = "someschema.user"

 ...for Mapper to issue the correct queries to the database.

 Thanks,
 Juan



 On Nov 19, 6:23 pm, David Pollak <feeder.of.the.be...@gmail.com>
 wrote:
 
> On Tue, Nov 17, 2009 at 10:50 AM, opyate <opy...@gmail.com> wrote:
 > > Hello Lifters,
 >
 > > I overrode newSuperConnection like so:
 >
 > > --START--
 > >      object DBVendor extends ConnectionManager {
 > >        def newConnection(name: ConnectionIdentifier): Box[Connection]
 > > = {
 > >          try {
 > >            Class.forName(dbDriver)
 > >            val dm =  DriverManager.getConnection(dbConnString,
 > > dbUser, dbPass)
 > >            Full(dm)
 > >          } catch {
 > >            case e => {
 > >              e.printStackTrace
 > >              Empty
 > >            }
 > >          }
 > >        }
 > >        def releaseConnection(conn: Connection) {conn.close}
 >
 > >        override def newSuperConnection(name: ConnectionIdentifier):
 > > Box[SuperConnection] = {
 > >            val c: Connection = newConnection(name).open_!
 > >            def release = () => releaseConnection(c)
 > >            Full(new SuperConnection(c, release, Full(schema) ))
 > >        }
 > >      }
 > > --END--
 >
 > > ...where "schema" is defined beforehand.
 >
 > > Now, I have to read/write to a Postgres table which is in a schema,
 > > e.g. "schemaname.tablename"
 >
 > > When I run my Lift code, I get the following exception:
 >
 > > Caught and thrown by:
 > > Message: org.postgresql.util.PSQLException: ERROR: relation
 > > "tablename" does not exist
 >
 > schemaName is used in Schemifier, but not in query construction.
 >
 > If this is a bug, please create a repro example (something we can use to
 > test) and open a ticket.
 >
 > Thanks,
 >
 > David
 >
 >
 >
 >
 >
 >
 >
 > > However, if I change the model from this:
 >
 > > override def dbTableName = "tablename"
 >
 > > to this:
 >
 > > override def dbTableName = "schemaname.tablename"
 >
 > > ...then things start working, but this is obviously not the intended
 > > way to achieve this, right?
 >
 > > Please let me know what I'm doing wrong.
 >
 > > Thanks,
 > > Juan
 >
 > > --
 >
 > > You received this message because you are subscribed to the Google Groups
 > > "Lift" group.
 > > To post to this group, send email to lift...@googlegroups.com.
 > > To unsubscribe from this group, send email to
> > liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com 
> > >
 
> > .
 > > For more options, visit this group at
 > >http://groups.google.com/group/liftweb?hl=.
 >
 > --
 > Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
 
> Follow me:http://twitter.com/dpp
 > Surf the harmonics

--

 You received this message because you are subscribed to the Google Groups 
"Lift" group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.





-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
--You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to