7/4/2025 5:33:23 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
Create entity for database view
Posted: 22 Jun 09 1:53 PM
|
Hi, I am trying to create an entity on top of a db view. Has anyone been able to consume a view in SLX web (7.5.1)?
I used the following sample view: CREATE VIEW [sysdba].[vwBlah] AS SELECT CONTACTID, 'Blah' AS Blah FROM sysdba.contact
I added the view to SLX in the administrator. AA adds it, but when I rebuild, I get the following error:
INFO - Generating Hibernate mapping file for Vwblah ERROR - NVelocity.Exception.MethodInvocationException: Invocation of method 'ToNHibernateType' in Sage.Platform.Orm.CodeGen.HbmGenerator threw exception System.ArgumentNullException : Value cannot be null. Parameter name: prop ---> System.ArgumentNullException: Value cannot be null. Parameter name: prop at Sage.Platform.Orm.CodeGen.HbmGenerator.ToNHibernateType(OrmEntityProperty prop) --- End of inner exception stack trace --- at NVelocity.Runtime.Parser.Node.ASTMethod.Execute(Object o, IInternalContextAdapter context) at NVelocity.Runtime.Parser.Node.ASTReference.Execute(Object o, IInternalContextAdapter context) at NVelocity.Runtime.Parser.Node.ASTReference.Render(IInternalContextAdapter context, TextWriter writer) at NVelocity.Runtime.Parser.Node.ASTBlock.Render(IInternalContextAdapter context, TextWriter writer) at NVelocity.Runtime.Parser.Node.SimpleNode.Render(IInternalContextAdapter context, TextWriter writer) at NVelocity.Runtime.Parser.Node.ASTIfStatement.Render(IInternalContextAdapter context, TextWriter writer) at NVelocity.Runtime.Parser.Node.SimpleNode.Render(IInternalContextAdapter context, TextWriter writer) at NVelocity.Template.Merge(IContext context, TextWriter writer) at Sage.Platform.TemplateSupport.Template.ApplyTemplate(TextWriter writer, Hashtable contexts) at Sage.Platform.Orm.CodeGen.BaseNVelocityGenerator.Generate(OrmEntity entity, TextWriter writer) at Sage.Platform.Orm.CodeGen.ServerEntityDeploymentPackage.GenerateInternal(OperationStatus op, BuildType buildType) at Sage.Platform.Extensibility.DeploymentPackageBase.Generate(OperationStatus op, BuildType buildType) at Sage.Platform.Extensibility.Services.RegisteredPlatform.Generate(IProject project, OperationStatus op, BuildType buildType) at Sage.Platform.AdminModule.AdminModuleInit.Deploy(RegisteredPlatform platform, OperationStatus op, BuildType buildType) at Sage.Platform.AdminModule.AdminModuleInit.BuildWebObjectsImpl(OperationStatus op)
|
|
|
|
Re: Create entity for database view
Posted: 23 Jun 09 2:42 AM
|
I'm not sure about this particular error, but you can definitely display views in SLX.
The error seems related to the type of the fields in the view...
Have you enebled the view in LAN Architect? Have you checked the primary key of your view? (Open with SQL Server Management Studio the ResyncTableDefs table and check the Primary Key.)
NHibernate requires a primary key property for each entity, so if you don't have a primary key it will not work.
If that is the problem, AFAIK, you'll have to fix it and recreate your entity in App Architect.
|
|
|
|
Re: Create entity for database view
Posted: 24 Jun 09 4:24 PM
|
Dave,
There is an issue with resolving key fields on existing db views when creating the entity in App Architect. To workaround this, you will need to open the actual XML definition file for the entity based on the view. This can be done using windows any text editor you prefer. The following steps should correct this problem for the view "MyView": 1) Navigate to the folder "Model\Entity Model\SalesLogix Application Entities\MyView" using windows file explorer if working in a Local File System (LFS), or use VFS explorer in App Architect if you're working from a database VFS. 2) Open the file "MyView.MYVIEW.entity.xml 3) Find the end tag that reads "/ExtendedPropertiesCollection" 4) Immediately after this section (and before the section "properties"), a section titled "keyProperties" should exist in the file, if not, add the following lines to the file: . a) keyProperties . b) keyReference id="ID from desired key property" ordinalPosition="1" / . c) /keyProperties 5) Replace the text "ID from desired key property" with the "id" value of the property that you wish to make the key. Keep the following in mind: . a) These will appear in properties section of the file . b) You will want to use GUID that is in the field "id" . c) You can add as many as you like, just be sure that the "ordinalPosition" tag is unique for each field . d) Be sure to paste the id within the double quotes 6) At this point, you should be able to save the file, re-build your entities, build the website and deploy the app.
Note that I had to remove all the greater than and less than signs from the above text to get it to post correctly here. You can use the XML file from any other entity as an example of what the syntax should look like. |
|
|
|
Re: Create entity for database view
Posted: 27 Aug 09 8:36 AM
|
Hi Mike, I am trying to create an entity on top of a db readonly view in SLX web (7.5.1) My database is on Oracle 64
The view belongs to SLX database but gives data from another database (from our ERP) CREATE OR REPLACE FORCE VIEW "SYSDBA"."POLY_EQUIPMENT_SLX" ("Article", "Designation", "Num_Serie", "Date_Achat", "Code_Type_Equpt", "Client", "Contrat", "Garantie") AS select "Article","Designation","Num_Serie","Date_Achat","Code_Type_Equpt","Client","Contrat","Garantie" from poly_equipment_ifs@prodv7.polysoude.fr WITH read only;
I encountered exactly the same error Dave described and so I applied your solution without any success. I still get the error : NVelocity.Exception.MethodInvocationException: Invocation of method 'ToNHibernateType' in Sage.Platform.Orm.CodeGen.HbmGenerator threw exception System.ArgumentNullException : Value cannot be null. Parameter name: prop ---> System.ArgumentNullException: Value cannot be null. |
|
|
|
Re: Create entity for database view
Posted: 27 Aug 09 10:50 AM
|
Cedirc, First, try deleting the Sage.Entity.Interfaces.dll from your reference assembly directory (on the tools menu in AA). You'll have to exit AA before the delete. This will force a re-build of the entire entity interface. If that does not work, can you post or send me your entity xml file? |
|
|
|
Re: Create entity for database view
Posted: 28 Aug 09 2:05 AM
|
Mike, I've deleted the Sage.Entity.Interfaces.dll and it solved the issue. Thanks a lot
Now I get another Error message before the end of the "build web platform"
===================================
An application exception has occurred.
===================================
Failed to build Sage.SalesLogix.Entities.dll. (Sage.Platform.Orm.CodeGen)
------------------------------ Program Location:
à Sage.Platform.Orm.CodeGen.ServerEntityDeploymentPackage.BuildProject(IEnumerable`1 buildItemFiles, Engine engine) à Sage.Platform.Orm.CodeGen.ServerEntityDeploymentPackage.GenerateInternal(OperationStatus op, BuildType buildType) à Sage.Platform.Extensibility.DeploymentPackageBase.Generate(OperationStatus op, BuildType buildType) à Sage.Platform.Extensibility.Services.RegisteredPlatform.Generate(IProject project, OperationStatus op, BuildType buildType) à Sage.Platform.AdminModule.AdminModuleInit.Deploy(RegisteredPlatform platform, OperationStatus op, BuildType buildType) à Sage.Platform.AdminModule.AdminModuleInit.BuildWebObjectsImpl(OperationStatus op) à Sage.Platform.AdminModule.AdminModuleInit.DoBuildWebObjects(Object sender, DoWorkEventArgs e) à System.ComponentModel.DoWorkEventHandler.Invoke(Object sender, DoWorkEventArgs e) à System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) à System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
AA's output window (translated from french): ################################ ERROR - C:\Documents and Settings\Administrateur\Application Data\Sage\Platform\Output\implementation\Equipment.cs(47,30):'Sage.SalesLogix.Entities.Equipment' doesn't implement interface member 'Sage.Entity.Interfaces.IEquipment.Num_serie.set'
ERROR - Failed to build Sage.SalesLogix.Entities.dll. ################################
In IEquipment.cs ... String Num_serie { get; set; } there's a "set;" method that shouldn't be here since the view is "read only":
#region Key Properties [Properties.ExtendedTypeInformationAttribute("Equipment_Num_serie", "Sage.Platform.Orm.DataTypes.TextDataType, Sage.Platform.Orm.CodeGen")] String Num_serie { get; set; } #endregion
Here follows the entity xml file: http://www.polysoude.com/misc/Equipment.POLY_EQUIPMENT_SLX.entity.xml
|
|
|
|
Re: Create entity for database view
Posted: 28 Aug 09 1:26 PM
|
Cedric, Try changing the isReadOnly proprty in that same XML file for the Num_serie field to false. Be sure to clean out your reference assembly and build directories in order to force a full rebuild. |
|
|
|
Re: Create entity for database view
Posted: 31 Aug 09 7:49 AM
|
Mike,
It solves the issue. Thank a lot
I added the matching smartpart and deployed the core portal. All went OK
But when browsing to the new smartpart in the webclient the system raised the following exception :
[QueryException: could not resolve property: Num_serie of: Sage.SalesLogix.Entities.Equipment] NHibernate.Persister.Entity.AbstractPropertyMapping.ToType(String propertyName) +118 NHibernate.Persister.Entity.AbstractEntityPersister.ToType(String propertyName) +50 NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetType(ICriteria subcriteria, String propertyName) +94 NHibernate.Criterion.PropertyProjection.GetTypes(ICriteria criteria, ICriteriaQuery criteriaQuery) +89 NHibernate.Criterion.ProjectionList.GetTypes(ICriteria criteria, ICriteriaQuery criteriaQuery) +154 NHibernate.Loader.Criteria.CriteriaQueryTranslator.get_ProjectedTypes() +68 NHibernate.Loader.Criteria.CriteriaJoinWalker..ctor(IOuterJoinLoadable persister, CriteriaQueryTranslator translator, ISessionFactoryImplementor factory, CriteriaImpl criteria, String rootEntityName, IDictionary`2 enabledFilters) +217 NHibernate.Loader.Criteria.CriteriaLoader..ctor(IOuterJoinLoadable persister, ISessionFactoryImplementor factory, CriteriaImpl rootCriteria, String rootEntityName, IDictionary`2 enabledFilters) +177 NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) +325 NHibernate.Impl.CriteriaImpl.List(IList results) +69 NHibernate.Impl.CriteriaImpl.List() +72 Sage.Platform.NHibernateRepository.Query.Criteria.List() +13 Sage.Platform.WebPortal.Binding.WebEntityListBindingSource.GetData(Int32 maximumRows, Int32 startRowIndex, String sortProperty, SortDirection sortDirection, Boolean asComponentView) +1089 Sage.Platform.WebPortal.Binding.WebEntityListBindingSource.GetData(Int32 maximumRows, Int32 startRowIndex, Boolean asComponentView) +73 Sage.Platform.WebPortal.Binding.WebEntityListBindingSource.OnCurrentSourceSet() +886 Sage.Platform.WebPortal.Binding.WebEntityBindingSource.SetCurrentSource(Object entity) +52 Sage.Platform.WebPortal.Binding.WebEntityBindingSource.set_SourceObject(Object value) +17 ASP.AccountEquipment.dsEquipments_OnCurrentEntitySet(Object sender, EventArgs e) +48 Sage.Platform.EntityBinding.EntityBindingSource.SetCurrentEntity(Object entity) +198 Sage.Platform.EntityBinding.EntityBindingSource.set_Current(Object value) +7 Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart.OnLoadCurrentEntity() +41 Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart.OnLoad(EventArgs e) +92 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
|
|
|
|
Re: Create entity for database view
Posted: 31 Aug 09 1:18 PM
|
This sounds like the underscore issue that is known to exist with column names. Can you re-create the view and remove the underscore from the column name? Note you'll have to update the properties in AA as well. |
|
|
|
Re: Create entity for database view
Posted: 01 Sep 09 2:53 AM
|
I remove every underscores (capital letters and so on) from the view and update AA properties. Same error...
[QueryException: could not resolve property: Serialnumber of: Sage.SalesLogix.Entities.Equipment] NHibernate.Persister.Entity.AbstractPropertyMapping.ToType(String propertyName) +118 NHibernate.Persister.Entity.AbstractEntityPersister.ToType(String propertyName) +50 [...]
|
|
|
| |
| |
| |
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|